javafx.scene.control.Button.setPrefWidth()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中javafx.scene.control.Button.setPrefWidth()方法的一些代码示例,展示了Button.setPrefWidth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setPrefWidth()方法的具体详情如下:
包路径:javafx.scene.control.Button
类名称:Button
方法名:setPrefWidth

Button.setPrefWidth介绍

暂无

代码示例

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.dialogs

void layout() {
  double maxWidth = 0;
  for (Button b : this.buttons) {
    maxWidth = Math.max(maxWidth, b.prefWidth(-1));
  }
  for (Button b : this.buttons) {
    b.setPrefWidth(maxWidth);
  }
  // Point2D size = getInitialSize();
  // stage.setWidth(size.getX());
  // stage.setHeight(size.getY());
  // stage.sizeToScene();
}

代码示例来源:origin: stackoverflow.com

@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
  btn2.setPrefWidth(newValue.intValue());

代码示例来源:origin: stackoverflow.com

@Override
 public void start(Stage primaryStage) {
   // Get the pane for the scene
   primaryStage.setScene(new Scene(getPane(), 180, 600));
   // Setup the stage
   primaryStage.setTitle("Elevator Buttons");
   primaryStage.setResizable(false);
   primaryStage.show();
 }
 protected Pane getPane() {
   Pane pane = new VBox(10);
   pane.setPadding(new Insets(40));
   GridPane grid = new GridPane();
   for (int i = 0; i < row; i++) {
     for (int k = 0; k < col; k++) {
       // Set the button number as text for the button
       Button button = new Button(Integer.toString((row * col - 2 * i - 1) + k));
       button.setPrefWidth(100);
       button.setStyle("-fx-font: 22 arial; -fx-base: LightGray");
       // Add the button to the pane and set the handler
       grid.add(button, k, i);
       button.setOnAction(buttonHandler);
     }
   }
   return grid;
 }

代码示例来源:origin: org.copper-engine/copper-monitoring-client

ok.setPrefWidth(100);
ok.setOnAction(new EventHandler<ActionEvent>() {
  @Override

代码示例来源:origin: eu.binjr/binjr-adapter-rrd4j

pathHBox.setAlignment(Pos.CENTER);
pathHBox.getChildren().addAll(pathsField, browseButton);
browseButton.setPrefWidth(-1);
pathsField.setPrefWidth(400);
DialogPane dialogPane = new DialogPane();

相关文章