根据标签大小设置文本大小

时间:2017-07-19 09:14:21

标签: java javafx javafx-2 javafx-8

为什么我的文字根据标签不符合规格。我已经关注了其他一些代码。

Label title0 = new Label();
title0.setMinSize(50,250);
Text t1 = new Text("TITLE1");

Bounds bounds1 = title0.getBoundsInLocal();
Bounds bounds2 = t1.getBoundsInLocal();
double scaley1 = bounds1.getHeight()/bounds2.getHeight();

t1.setScaleY(scaley1);
title0.setText(t1.getText());

0 个答案:

没有答案