【发布时间】:2014-11-25 14:58:42
【问题描述】:
我想要一个分隔符,它可以根据母组件的大小来改变他的大小。 在我的示例中,我有一个 JavaFX 弹出窗口,并在那里添加了一个 VBox。在这个 VBox 中,我添加了一个 HBox。而这个 HBox 有一个标签、一个分隔符和一个按钮。 现在我想让按钮在右端,标签在 HBox 的左端。我想我必须在这些组件之间使用分隔符来获得空间。
我该如何处理...
我做了这样的东西,但它不起作用。
// Box for the Headline
HBox headLine = new HBox();
headLine.setPadding(new Insets(5, 5, 5, 5));
// Label with the HeadLine Description in
final Label heading = new Label(headLineText);
heading.getStyleClass().addAll("popup-label-name");
// Close Button
close = new Button("X");
close.setVisible(false);
closeButtonHandler();
// Creates an invisble Separator1
Separator sep = new Separator(Orientation.HORIZONTAL);
sep.setVisible(false);
sep.widthProperty().add(m_container.widthProperty().get());
close.getStyleClass().addAll("popup-button", "popup-button-color");
// Adds to the Headline the Data
headLine.getChildren().addAll(heading, sep, close);
变量 m_container 是 VBox!我该如何处理?
感谢您的帮助:)
【问题讨论】:
-
您只需要空格吗?还是可见的分隔符?
标签: properties javafx width separator