【发布时间】:2015-01-07 07:20:33
【问题描述】:
我想在 HBox 的左侧放置一个垂直(旋转 90 度)标签。网格窗格应填满整个剩余空间。如果我减少旋转标签的 with 以减少其所需的水平空间,则文本长度会缩小。否则,如果我手动降低高度,则不会发生任何事情。
如何减少旋转标签的使用?
使用 Scenebuilder 和 Windows 7。
【问题讨论】:
标签: text javafx rotation width
我想在 HBox 的左侧放置一个垂直(旋转 90 度)标签。网格窗格应填满整个剩余空间。如果我减少旋转标签的 with 以减少其所需的水平空间,则文本长度会缩小。否则,如果我手动降低高度,则不会发生任何事情。
如何减少旋转标签的使用?
使用 Scenebuilder 和 Windows 7。
【问题讨论】:
标签: text javafx rotation width
旋转Label 并将其包裹在Group 中。将转换应用于标签后将计算组的布局边界:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class RotatedLabelTest extends Application {
@Override
public void start(Stage primaryStage) {
Label hello = new Label("Hello");
Label world = new Label("World");
hello.setRotate(90);
world.setRotate(90);
HBox root = new HBox(5, new Group(hello), new Group(world));
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
【讨论】: