List of usage examples for javafx.scene.layout BorderPane setCenter
public final void setCenter(Node value)
From source file:Main.java
@Override public void start(final Stage stage) { final Node loginPanel = makeDraggable(createLoginPanel()); final Node confirmationPanel = makeDraggable(createConfirmationPanel()); final Node progressPanel = makeDraggable(createProgressPanel()); loginPanel.relocate(0, 0);/*w ww. j a va 2s. c o m*/ confirmationPanel.relocate(0, 67); progressPanel.relocate(0, 106); final Pane panelsPane = new Pane(); panelsPane.getChildren().addAll(loginPanel, confirmationPanel, progressPanel); final BorderPane sceneRoot = new BorderPane(); BorderPane.setAlignment(panelsPane, Pos.TOP_LEFT); sceneRoot.setCenter(panelsPane); final CheckBox dragModeCheckbox = new CheckBox("Drag mode"); BorderPane.setMargin(dragModeCheckbox, new Insets(6)); sceneRoot.setBottom(dragModeCheckbox); dragModeActiveProperty.bind(dragModeCheckbox.selectedProperty()); final Scene scene = new Scene(sceneRoot, 400, 300); stage.setScene(scene); stage.setTitle("Draggable Panels Example"); stage.show(); }
From source file:org.pdfsam.ui.dialog.OverwriteConfirmationDialog.java
@Inject public OverwriteConfirmationDialog(StylesConfig styles) { initModality(Modality.WINDOW_MODAL); initStyle(StageStyle.UTILITY);// w w w. ja va 2 s. c o m setResizable(false); BorderPane containerPane = new BorderPane(); containerPane.getStyleClass().addAll(Style.CONTAINER.css()); containerPane.getStyleClass().addAll("-pdfsam-dialog", "-pdfsam-warning-dialog"); containerPane.setCenter(dialogContent); HBox buttons = new HBox(buildButton(DefaultI18nContext.getInstance().i18n("Overwrite"), true), buildButton(DefaultI18nContext.getInstance().i18n("Cancel"), false)); buttons.getStyleClass().add("-pdfsam-dialog-buttons"); containerPane.setBottom(buttons); Scene scene = new Scene(containerPane); scene.getStylesheets().addAll(styles.styles()); scene.setOnKeyReleased(new HideOnEscapeHandler(this)); setScene(scene); }
From source file:be.makercafe.apps.makerbench.editors.XMLEditor.java
public XMLEditor(String tabText, Path path) { super(tabText); this.caCodeArea = new CodeArea(""); this.caCodeArea.setEditable(true); this.caCodeArea.setParagraphGraphicFactory(LineNumberFactory.get(caCodeArea)); this.caCodeArea.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE); this.caCodeArea.getStylesheets().add(this.getClass().getResource("xml-highlighting.css").toExternalForm()); this.caCodeArea.textProperty().addListener((obs, oldText, newText) -> { this.caCodeArea.setStyleSpans(0, computeHighlighting(newText)); });/*from ww w. java 2s . c o m*/ addContextMenu(this.caCodeArea); try { this.caCodeArea.replaceText(FileUtils.readFileToString(path.toFile())); } catch (IOException ex) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error reading file.", ex); } BorderPane rootPane = new BorderPane(); toolBar = createToolBar(); rootPane.setTop(toolBar); rootPane.setCenter(caCodeArea); this.getTab().setContent(rootPane); }
From source file:cz.lbenda.gui.tableView.FilterableTableColumn.java
public FilterableTableColumn() { super();/* w ww . j ava 2 s . c om*/ BorderPane bPane = new BorderPane(); leftIndicatorPane.setAlignment(Pos.CENTER_LEFT); rightIndicatorPane.setAlignment(Pos.CENTER_RIGHT); bPane.setLeft(leftIndicatorPane); bPane.setRight(rightIndicatorPane); bPane.setCenter(title); this.setGraphic(bPane); }
From source file:org.pdfsam.ui.news.NewsStage.java
@Inject public NewsStage(Collection<Image> logos, StylesConfig styles, @Named("newsDisplayPolicy") PreferenceComboBox<KeyStringValueItem<String>> newsDisplayPolicy) { BorderPane containerPane = new BorderPane(); browser.setId("newsBrowser"); containerPane.getStyleClass().addAll(Style.CONTAINER.css()); containerPane.getStyleClass().add("-pdfsam-news-pane"); containerPane.setCenter(browser); HBox bottom = new HBox(); ClosePane closePane = new ClosePane(); HBox.setHgrow(closePane, Priority.ALWAYS); HBox comboPanel = new HBox(new Label(DefaultI18nContext.getInstance().i18n("Show this:")), newsDisplayPolicy);//from www. ja va2s . c o m comboPanel.getStyleClass().addAll(Style.CONTAINER.css()); comboPanel.getStyleClass().add("-pdfsam-news-pane-bottom"); bottom.getChildren().addAll(comboPanel, closePane); containerPane.setBottom(bottom); Scene scene = new Scene(containerPane); scene.getStylesheets().addAll(styles.styles()); scene.setOnKeyReleased(new HideOnEscapeHandler(this)); setScene(scene); setTitle(DefaultI18nContext.getInstance().i18n("What's new")); getIcons().addAll(logos); setMaximized(false); }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 500, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);//w ww . java 2 s . co m gridpane.setVgap(10); root.setCenter(gridpane); ObservableList<Person> leaders = getPeople(); final ObservableList<Person> teamMembers = FXCollections.observableArrayList(); ListView<Person> leaderListView = createLeaderListView(leaders); TableView<Person> employeeTableView = createEmployeeTableView(teamMembers); Label bossesLbl = new Label("Boss"); GridPane.setHalignment(bossesLbl, HPos.CENTER); gridpane.add(bossesLbl, 0, 0); gridpane.add(leaderListView, 0, 1); Label emplLbl = new Label("Employees"); GridPane.setHalignment(emplLbl, HPos.CENTER); gridpane.add(emplLbl, 2, 0); gridpane.add(employeeTableView, 2, 1); leaderListView.getSelectionModel().selectedItemProperty() .addListener((ObservableValue<? extends Person> observable, Person oldValue, Person newValue) -> { if (observable != null && observable.getValue() != null) { teamMembers.clear(); teamMembers.addAll(observable.getValue().employeesProperty()); } }); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Tabs"); Group root = new Group(); 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(); tab.setText("Tab" + i); HBox hbox = new HBox(); hbox.getChildren().add(new Label("Tab" + i)); hbox.setAlignment(Pos.CENTER);/* ww w . j av a 2s. co m*/ tab.setContent(hbox); tabPane.getTabs().add(tab); } // bind to take available space borderPane.prefHeightProperty().bind(scene.heightProperty()); borderPane.prefWidthProperty().bind(scene.widthProperty()); borderPane.setCenter(tabPane); root.getChildren().add(borderPane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:be.makercafe.apps.makerbench.editors.JFXMillEditor.java
public JFXMillEditor(String tabText, Path path) { super(tabText); this.viewGroup = new Group(); this.editorContainer = new BorderPane(); this.viewContainer = new Pane(); this.caCodeArea = new CodeArea(""); this.caCodeArea.setEditable(true); this.caCodeArea.setParagraphGraphicFactory(LineNumberFactory.get(caCodeArea)); this.caCodeArea.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE); this.caCodeArea.getStylesheets().add(this.getClass().getResource("java-keywords.css").toExternalForm()); this.caCodeArea.richChanges().subscribe(change -> { caCodeArea.setStyleSpans(0, computeHighlighting(caCodeArea.getText())); });//from w ww .j a va 2s.c o m addContextMenu(this.caCodeArea); EventStream<Change<String>> textEvents = EventStreams.changesOf(caCodeArea.textProperty()); textEvents.reduceSuccessions((a, b) -> b, Duration.ofMillis(3000)).subscribe(code -> { if (autoCompile) { compile(code.getNewValue()); } }); try { this.caCodeArea.replaceText(FileUtils.readFileToString(path.toFile())); } catch (IOException ex) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error reading file.", ex); } SplitPane editorPane = new SplitPane(caCodeArea, viewContainer); editorPane.setOrientation(Orientation.HORIZONTAL); BorderPane rootPane = new BorderPane(); toolBar = createToolBar(); rootPane.setTop(toolBar); rootPane.setCenter(editorPane); this.getTab().setContent(rootPane); }
From source file:RemoveDuplicateFiles.java
public static Scene makeScene() { //Setup the main BorderPane (Holds all the things) BorderPane backPane = new BorderPane(); //---------------------------------------------------------------------- //Setup the Main Menu Buttons & Pane sortFilesButton = new Button("Sort Files"); batchRenameButton = new Button("Batch Rename Files"); HBox mainButtons = new HBox(); mainButtons.setPadding(new Insets(15, 12, 15, 12)); mainButtons.setSpacing(10);//from www . ja v a2 s . c om mainButtons.setStyle(BUTTON_STYLE); mainButtons.getChildren().add(sortFilesButton); mainButtons.getChildren().add(batchRenameButton); backPane.setTop(mainButtons); //---------------------------------------------------------------------- //Setup the filetypes box HBox fileTypePane = GUIFactories.getFileTypeBox(fileTypes); backPane.setBottom(fileTypePane); //---------------------------------------------------------------------- //Setup the FileType Pre-set Buttons VBox preSets = GUIFactories.getPresets(fileTypes); backPane.setRight(preSets); //---------------------------------------------------------------------- //Setup the center GridPane rmvButton = new Button("Remove Duplicates"); actionTarget = new Text(); GridPane grid = GUIFactories.getCenterPane(address, rmvButton, actionTarget); backPane.setCenter(grid); //---------------------------------------------------------------------- Scene scene = new Scene(backPane, WIDTH, HEIGHT); return scene; }
From source file:AudioPlayer3.java
@Override public void start(Stage primaryStage) { System.out.println("JavaFX version: " + VersionInfo.getRuntimeVersion()); songModel.setURL("http://traffic.libsyn.com/dickwall/JavaPosse373.mp3"); metaDataView = new MetadataView(songModel); playerControlsView = new PlayerControlsView(songModel); final BorderPane root = new BorderPane(); root.setCenter(metaDataView.getViewNode()); root.setBottom(playerControlsView.getViewNode()); final Scene scene = new Scene(root, 800, 400); initSceneDragAndDrop(scene);// www.ja v a 2s .c o m final URL stylesheet = getClass().getResource("media.css"); scene.getStylesheets().add(stylesheet.toString()); primaryStage.setScene(scene); primaryStage.setTitle("Audio Player 3"); primaryStage.show(); }