javafx.scene.layout.BorderPane.setCenter()方法的使用及代码示例

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

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

BorderPane.setCenter介绍

暂无

代码示例

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

final BorderPane root = new BorderPane();
// construct your VBox
root.setCenter(vbox);

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

@Override
public void start(Stage stage) throws Exception {
  BorderPane pane = new BorderPane();
  ImageView img = new ImageView("http://...");

  img.fitWidthProperty().bind(stage.widthProperty()); 

  pane.setCenter(img);

  Scene scene = new Scene(pane);
  stage.setScene(scene);
  stage.show();
}

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

public static Scene secondScene(final Stage primaryStage){
   BorderPane pane = new BorderPane();
   Label l = new Label("Second Scene");
   pane.setCenter(l);

   //let's say I have a button that changes back to original stage
   Button b = new Button("Main stage");  
   b.setOnAction(new EventHandler<ActionEvent>(){
   public void handle(ActionEvent t){
      // create your own Scene and then set it to primaryStage
     primaryStage.setScene(new Scene ... );
   }
   });

   return new Scene(pane, 300, 300);
}

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

BorderPane layout = new BorderPane();
layout.setLeft(optionPane);
layout.setCenter(editorBox);
stage.setScene(new Scene(layout));
stage.show();

代码示例来源:origin: jfoenixadmin/JFoenix

protected BorderPane createCalendarMonthLabelPane() {
  monthYearLabel = new Label();
  monthYearLabel.getStyleClass().add(SPINNER_LABEL);
  monthYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 13));
  monthYearLabel.setTextFill(DEFAULT_COLOR);
  BorderPane monthContainer = new BorderPane();
  monthContainer.setMinHeight(50);
  monthContainer.setCenter(monthYearLabel);
  monthContainer.setPadding(new Insets(2, 12, 2, 12));
  return monthContainer;
}

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

Stage stage = new Stage();
stage.setTitle("Hello World");

final BorderPane border = new BorderPane();
Scene scene = new Scene(border);

Button button = new Button("test");

HBox outerHBox = new HBox();
outerHBox.getChildren().add(button);
outerHBox.setAlignment(Pos.CENTER);

border.setCenter(outerHBox);

stage.setScene(scene);

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

public class ContactApp extends Application {

  @Override
  public void start(Stage primaryStage) throws Exception {

    BorderPane root = new BorderPane();
    FXMLLoader listLoader = new FXMLLoader(getClass().getResource("list.fxml"));
    root.setCenter(listLoader.load());
    ListController listController = listLoader.getController();

    FXMLLoader editorLoader = new FXMLLoader(getClass().getResource("editor.fxml"));
    root.setRight(editorLoader.load());
    EditorController editorController = editorLoader.getController();

    FXMLLoader menuLoader = new FXMLLoader(getClass().getResource("menu.fxml"));
    root.setTop(menuLoader.load());
    MenuController menuController = menuLoader.getController();

    DataModel model = new DataModel();
    listController.initModel(model);
    editorController.initModel(model);
    menuController.initModel(model);

    Scene scene = new Scene(root, 800, 600);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

contentPane.setPadding(new Insets(12));
BorderPane contentContainer = new BorderPane();
contentContainer.setCenter(contentPane);
contentContainer.setMinHeight(50);
contentContainer.setPadding(new Insets(2, 12, 2, 12));

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

final int HEIGHT = 600;
BorderPane root = new BorderPane();
  root.setCenter(searchRoot);
});
addButton.setOnAction((ActionEvent event) -> {
  System.out.println("Add Button Pressed");
  root.setCenter(addRoot);
});
viewButton.setOnAction((ActionEvent event) -> {
  System.out.println("Soup");
  root.setCenter(viewRoot);
});
primaryStage.setScene(scene);

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

BorderPane root = new BorderPane();
root.setCenter(table);
primaryStage.setScene(new Scene(root));
primaryStage.show();

代码示例来源:origin: torakiki/pdfsam

@Inject
public OpenWithDialog(StylesConfig styles, List<Module> modules) {
  initModality(Modality.WINDOW_MODAL);
  initStyle(StageStyle.UTILITY);
  setResizable(false);
  setTitle(DefaultI18nContext.getInstance().i18n("Open with"));
  this.modules = modules.stream().sorted(comparing(m -> m.descriptor().getName())).collect(toList());
  messageTitle.getStyleClass().add("-pdfsam-open-with-dialog-title");
  BorderPane containerPane = new BorderPane();
  containerPane.getStyleClass().addAll(Style.CONTAINER.css());
  containerPane.getStyleClass().addAll("-pdfsam-open-with-dialog", "-pdfsam-open-with-container");
  containerPane.setTop(messageTitle);
  BorderPane.setAlignment(messageTitle, Pos.TOP_CENTER);
  filesList.setPrefHeight(150);
  containerPane.setCenter(filesList);
  buttons.getStyleClass().addAll(Style.CONTAINER.css());
  containerPane.setBottom(buttons);
  BorderPane.setAlignment(buttons, Pos.CENTER);
  Scene scene = new Scene(containerPane);
  scene.getStylesheets().addAll(styles.styles());
  scene.setOnKeyReleased(new HideOnEscapeHandler(this));
  setScene(scene);
  eventStudio().addAnnotatedListeners(this);
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Prepare Stage for dock feedback display
 */
void buildDockFeedbackStage() {
 dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT);
 dockFeedback = new Rectangle(0, 0, 100, 100);
 dockFeedback.setArcHeight(10);
 dockFeedback.setArcWidth(10);
 dockFeedback.setFill(Color.TRANSPARENT);
 dockFeedback.setStroke(Color.BLACK);
 dockFeedback.setStrokeWidth(2);
 dockFeedback.setCache(true);
 dockFeedback.setCacheHint(CacheHint.SPEED);
 dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3));
 dockFeedback.setMouseTransparent(true);
 BorderPane borderpane = new BorderPane();
 borderpane.setStyle("-fx-background-color:transparent"); // J8
 borderpane.setCenter(dockFeedback);
 Scene scene = new Scene(borderpane);
 scene.setFill(Color.TRANSPARENT);
 dockFeedbackPopup.setScene(scene);
 dockFeedbackPopup.sizeToScene();
}

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

BorderPane root = new BorderPane();
Label label = new Label("Some\ntext");
label.setGraphic(new ImageView(getClass().getResource("/images/Folder-icon.png").toExternalForm()));
label.setMaxHeight(Double.POSITIVE_INFINITY);
label.setStyle("-fx-border-color: blue;");
root.setCenter(label);
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: torakiki/pdfsam

@Inject
public InfoStage(InfoPane infoPane, List<Image> logos, StylesConfig styles) {
  BorderPane containerPane = new BorderPane();
  containerPane.getStyleClass().addAll(Style.CONTAINER.css());
  containerPane.setCenter(infoPane);
  containerPane.setBottom(new ClosePane());
  Scene scene = new Scene(containerPane);
  scene.getStylesheets().addAll(styles.styles());
  scene.setOnKeyReleased(new HideOnEscapeHandler(this));
  setScene(scene);
  setTitle(DefaultI18nContext.getInstance().i18n("Document details"));
  getIcons().addAll(logos);
  setMaximized(true);
}

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

Scene scene = new Scene(root, 400, 250, Color.WHITE);
TabPane tabPane = new TabPane();
BorderPane borderPane = new BorderPane();
for (int i = 0; i < 5; i++) {
 Tab tab = new Tab();
borderPane.prefWidthProperty().bind(scene.widthProperty());
borderPane.setCenter(tabPane);
root.getChildren().add(borderPane);
primaryStage.setScene(scene);
primaryStage.show();

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

@Override
@SuppressWarnings("unchecked")
public Node createContent() {
  borderPane = new BorderPane();
  borderPane.setCenter(dataEditorState.createVisualisation());
  return borderPane;
}

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

BorderPane pane = new BorderPane();
pane.setTop(hBox);
pane.setCenter(table);
stage.setScene(new Scene(pane, 640, 480));
stage.show();

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

BorderPane border = new BorderPane();
Label toppanetext = new Label("Page Title");
border.setTop(toppanetext);
Label centerpanetext = new Label ("Some data here");
border.setCenter(centerpanetext);

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

private BorderPane root;

@Override
public void start(Stage stage) throws Exception
{
  root = new BorderPane();
  //ROOT SHOULD BE ONE OF THE LAYOUTS : BorderPane, HBox, VBox, StackPane,     
  //GridPane, FlowPane
  scene = new Scene(root, 500, 500);

  stage.setScene(scene);

  stage.show();
  root.setCenter(new Label("sample label"));
}

代码示例来源:origin: torakiki/pdfsam

@Inject
public LogStage(LogPane logPane, LogListView logView, List<Image> logos, StylesConfig styles) {
  BorderPane containerPane = new BorderPane();
  containerPane.getStyleClass().addAll(Style.CONTAINER.css());
  containerPane.setCenter(logPane);
  containerPane.setBottom(new ClosePane((a) -> eventStudio().broadcast(HideStageRequest.INSTANCE, "LogStage")));
  Scene scene = new Scene(containerPane);
  scene.getStylesheets().addAll(styles.styles());
  scene.setOnKeyReleased(k -> {
    if (this.isShowing() && new KeyCodeCombination(KeyCode.ESCAPE).match(k)) {
      eventStudio().broadcast(HideStageRequest.INSTANCE, "LogStage");
    }
  });
  setScene(scene);
  setTitle(DefaultI18nContext.getInstance().i18n("Log register"));
  getIcons().addAll(logos);
  setMaximized(true);
  eventStudio().addAnnotatedListeners(this);
  this.onShowingProperty().addListener((o, oldVal, newVal) -> logView.scrollToBottomIfShowing());
  eventStudio().add(logView, LOGSTAGE_EVENTSTATION);
}

相关文章