我想获得一个分隔符,它会根据母版组件的大小更改其大小。 在我的例子中,我有一个JavaFX Popup,在那里我添加一个VBox。为了这个VBox,我添加了一个HBox。而这个HBox有一个Label,一个Speparator和一个Button。 现在我想要让按钮位于右端,标签位于HBox的左端。我想我必须使用这些组件之间的分隔符来获取空间。JavaFX分隔符不依赖于类的宽度
我该如何处理呢?
我做了这样的事情,但它不工作。
// 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!我该如何处理它?
感谢您的帮助:)
你只是想空白?或可见的分隔符? – 2014-11-25 17:20:18