本文整理匯總了Java中javafx.scene.layout.HBox.setPrefWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java HBox.setPrefWidth方法的具體用法?Java HBox.setPrefWidth怎麽用?Java HBox.setPrefWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.HBox
的用法示例。
在下文中一共展示了HBox.setPrefWidth方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: setupArchitectureManagementVisuals
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
/**
* Create the different buttons for the architecture management and add the desired actions to them
*/
private void setupArchitectureManagementVisuals() {
HBox buttons = new HBox();
Button configButton = new Button("Config");
Button startButton = new Button("Start");
Button pauseButton = new Button("Pause");
Button resumeButton = new Button("Resume");
Button stopButton = new Button("Stop");
buttons.getChildren().addAll(configButton, startButton, pauseButton, resumeButton, stopButton);
BorderPane borderPane = new BorderPane();
borderPane.setPrefHeight(canvas.getScene().getHeight());
borderPane.setPrefWidth(canvas.getScene().getWidth());
Pane space = new Pane();
space.setMinSize(1, 1);
HBox.setHgrow(space, Priority.ALWAYS);
HBox container = new HBox();
container.setPrefWidth(canvas.getScene().getWidth());
container.getChildren().addAll(space, buttons);
borderPane.setBottom(container);
root.getChildren().add(borderPane);
configButton.setOnMouseClicked(new ArchitectureButtonEventHandler(SimulationAction.CONFIG, publisher));
startButton.setOnMouseClicked(new ArchitectureButtonEventHandler(SimulationAction.START, publisher));
stopButton.setOnMouseClicked(new ArchitectureButtonEventHandler(SimulationAction.STOP, publisher));
pauseButton.setOnMouseClicked(new ArchitectureButtonEventHandler(SimulationAction.PAUSE, publisher));
resumeButton.setOnMouseClicked(new ArchitectureButtonEventHandler(SimulationAction.RESUME, publisher));
}
示例3: initTabProcesses
import javafx.scene.layout.HBox; //導入方法依賴的package包/類
private Node initTabProcesses() {
userProcessesList = FXCollections.observableArrayList();
allProcessesList = FXCollections.observableArrayList();
ProcessesUtil.getProcesses(allProcessesList, true);
ProcessesUtil.getProcesses(userProcessesList, false);
TableColumn pidCol = new TableColumn("PID");
TableColumn nameCol = new TableColumn("Nome do processo");
TableColumn userCol = new TableColumn("Usuário");
TableColumn cpuCol = new TableColumn("CPU (%)");
TableColumn memCol = new TableColumn("Memória (%)");
pidCol.setCellValueFactory(
new PropertyValueFactory<>("pid")
);
nameCol.setCellValueFactory(
new PropertyValueFactory<>("readableName")
);
userCol.setCellValueFactory(
new PropertyValueFactory<>("user")
);
cpuCol.setCellValueFactory(
new PropertyValueFactory<>("CPU")
);
memCol.setCellValueFactory(
new PropertyValueFactory<>("MEM")
);
viewProcesses = new TableView();
viewProcesses.setEditable(false);
viewProcesses.getColumns().addAll(pidCol, nameCol, userCol, cpuCol, memCol);
viewProcesses.setItems(userProcessesList);
viewProcesses.setOnMousePressed(mouseEventHandler);
checkBoxAllProcesses = new CheckBox("Processos de todos usuários");
checkBoxAllProcesses.setOnAction(actionEventHandler);
inputFilter = new TextField();
inputFilter.textProperty().addListener(this);
Label labelFilter = new Label("Filtrar:");
labelFilter.setPadding(new Insets(0, 10, 0, 0));
HBox hBoxFilter = new HBox(labelFilter, inputFilter);
hBoxFilter.setAlignment(Pos.BASELINE_RIGHT);
HBox.setHgrow(hBoxFilter, Priority.ALWAYS);
HBox hBoxOptions = new HBox(checkBoxAllProcesses, hBoxFilter);
hBoxOptions.setPrefWidth(prefWidth);
hBoxOptions.setPadding(new Insets(10));
return new VBox(viewProcesses, hBoxOptions);
}