本文整理汇总了Java中javafx.scene.layout.HBox.setPrefHeight方法的典型用法代码示例。如果您正苦于以下问题:Java HBox.setPrefHeight方法的具体用法?Java HBox.setPrefHeight怎么用?Java HBox.setPrefHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.HBox
的用法示例。
在下文中一共展示了HBox.setPrefHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAlignment
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void setAlignment() {
label.setPrefWidth(200);
changeButton.setMinWidth(71);
unbindButton.setMinWidth(71);
hbox = new HBox(label, textField, changeButton, unbindButton);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPrefHeight(31);
label.setText(getPrettyName());
label.setAlignment(Pos.CENTER_LEFT);
Insets labelInset = new Insets(0, 0, 0, 10);
Insets buttonInset = new Insets(0, 10, 0, 0);
unbindButton.setMinHeight(31);
hbox.setMargin(label, labelInset);
hbox.setMargin(unbindButton, buttonInset);
textField.setEditable(false);
hbox.setHgrow(textField, Priority.ALWAYS);
}
示例2: getMessageBar
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private Node getMessageBar(VBox vbox) {
HBox hb = new HBox(10);
hb.setPrefHeight(32);
hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";");
CheckBox cb = new CheckBox("Do Not Show Again");
cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _message_fg + ";");
Text b = FXUIUtils.getIconAsText("close");
b.setOnMouseClicked((e) -> {
JSONObject preferences = Preferences.instance().getSection("display");
preferences.put("_doNotShowMessage", cb.isSelected());
Preferences.instance().save("display");
vbox.getChildren().remove(0);
});
Text t = new Text(_message);
hb.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(t, Priority.ALWAYS);
t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
b.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold;");
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
hb.getChildren().addAll(t, spacer, b);
return hb;
}
示例3: createHBox
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private Node createHBox (String item) {
HBox hbox = new HBox();
hbox.setAlignment(Pos.CENTER);
hbox.getChildren().add(myFactory.createSubTitleLabel(item));
hbox.setPrefHeight(myHeight);
return hbox;
}
示例4: initBoxes
import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void initBoxes(Pane root, Scene scene) {
VBox vBox = Nodes.TEXT_VBOX;
HBox hBox = Nodes.TEXTBAR_HBOX;
ScrollPane scrollPane = Nodes.SCROLL_PANE;
vBox.setTranslateY(10);
vBox.setTranslateX(10);
vBox.prefWidthProperty().bind(scene.widthProperty().subtract(10));
vBox.prefHeightProperty().bind(scene.heightProperty().subtract(20).subtract(preferences.getDouble("textbar-height")));
vBox.setSpacing((preferences.getDouble("messages-spacing-level") - 1)*10-5);
hBox.setPrefWidth(scene.getWidth());
hBox.setPrefHeight(preferences.getDouble("textbar-height"));
hBox.setTranslateY(scene.getHeight() - hBox.getPrefHeight());
hBox.setSpacing(20);
root.widthProperty().addListener(o -> hBox.setPrefWidth(root.getWidth()));
root.heightProperty().addListener(o -> hBox.setTranslateY(scene.getHeight() - Nodes.TEXTBAR_HBOX.getPrefHeight()));
scrollPane.setContent(vBox);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setTranslateX(vBox.getTranslateX());
scrollPane.setTranslateY(vBox.getTranslateY());
scrollPane.maxWidthProperty().bind(vBox.prefWidthProperty());
scrollPane.prefWidthProperty().bind(vBox.prefWidthProperty());
scrollPane.prefHeightProperty().bind(vBox.prefHeightProperty());
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
}