List of usage examples for javafx.scene.layout BorderPane BorderPane
public BorderPane()
From source file:gov.va.isaac.sync.view.SyncView.java
private void initGui() { root_ = new BorderPane(); root_.setPrefWidth(550);/*w ww .j a v a 2 s.c om*/ VBox titleBox = new VBox(); Label title = new Label("Datastore Synchronization"); title.getStyleClass().add("titleLabel"); title.setAlignment(Pos.CENTER); title.setMaxWidth(Double.MAX_VALUE); title.setPadding(new Insets(10)); titleBox.getChildren().add(title); titleBox.getStyleClass().add("headerBackground"); url_ = AppContext.getAppConfiguration().getCurrentChangeSetUrl(); String urlType = AppContext.getAppConfiguration().getChangeSetUrlTypeName(); String syncUsername = ExtendedAppContext.getCurrentlyLoggedInUserProfile().getSyncUsername(); if (StringUtils.isBlank(syncUsername)) { syncUsername = ExtendedAppContext.getCurrentlyLoggedInUser(); } url_ = syncService_.substituteURL(url_, syncUsername); Label info = new CopyableLabel("Sync using " + urlType + ": " + url_); info.setTooltip(new Tooltip(url_)); titleBox.getChildren().add(info); titleBox.setPadding(new Insets(5, 5, 5, 5)); root_.setTop(titleBox); VBox centerContent = new VBox(); centerContent.setFillWidth(true); centerContent.setPrefWidth(Double.MAX_VALUE); centerContent.setPadding(new Insets(10)); centerContent.getStyleClass().add("itemBorder"); centerContent.setSpacing(10.0); centerContent.getChildren().add(new Label("Status:")); summary_ = new TextArea(); summary_.setWrapText(true); summary_.setEditable(false); summary_.setMaxWidth(Double.MAX_VALUE); summary_.setMaxHeight(Double.MAX_VALUE); summary_.setPrefHeight(150.0); centerContent.getChildren().add(summary_); VBox.setVgrow(summary_, Priority.ALWAYS); pb_ = new ProgressBar(0.0); pb_.setPrefHeight(20); pb_.setMaxWidth(Double.MAX_VALUE); centerContent.getChildren().add(pb_); root_.setCenter(centerContent); //Bottom buttons HBox buttons = new HBox(); buttons.setMaxWidth(Double.MAX_VALUE); buttons.setAlignment(Pos.CENTER); buttons.setPadding(new Insets(5)); buttons.setSpacing(30); Button cancel = new Button("Close"); cancel.setOnAction((action) -> { if (running_.get()) { addLine("Cancelling..."); cancel.setDisable(true); cancelRequested_ = true; } else { cancel.getScene().getWindow().hide(); root_ = null; } }); buttons.getChildren().add(cancel); Button action = new Button("Synchronize"); action.disableProperty().bind(running_); action.setOnAction((theAction) -> { summary_.setText(""); pb_.setProgress(-1.0); running_.set(true); Utility.execute(() -> sync()); }); buttons.getChildren().add(action); cancel.minWidthProperty().bind(action.widthProperty()); running_.addListener(change -> { if (running_.get()) { cancel.setText("Cancel"); } else { cancel.setText("Close"); } cancel.setDisable(false); }); root_.setBottom(buttons); }
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);// w w w. ja va 2s . co m final URL stylesheet = getClass().getResource("media.css"); scene.getStylesheets().add(stylesheet.toString()); primaryStage.setScene(scene); primaryStage.setTitle("Audio Player 3"); primaryStage.show(); }
From source file:investor.views.MarketIndicisesView.java
public void InitView() { pane = new VBox(); //Stworzenie wykresu lineChart = LinearChartManager.linear(); lineChart.setTitle(""); //Poczatkowo zakres dat to 3M selectedRange = DataRange.THREEMONTH; selectedChart = "line"; //Stworzenie tabelki table = new TableView(); //Scigamy dane dla tabelki z serwera i populujemy tabelke try {// w w w. j a v a2s. c om table.getItems().addAll(NetworkManager.show(DataType.WSK)); } catch (Exception e) { System.out.println("Something went wrong when populating market indicisies view"); } //Dodajemy kolumny do tabelki table.getColumns().addAll(initColumns()); //Obsuga kliknicia wiersza w tabelce table.setRowFactory(tv -> { TableRow<Index> row = new TableRow<Index>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && (!row.isEmpty())) { //Zapamitujemy wybrany wiersz dla widoku Index rowData = row.getItem(); selectedIndex = rowData; //System.out.println(rowData); try { //Scigamy dane z serwera dla danego wiersza i dodajemy je do wykresu lastData = NetworkManager.showMore(rowData.getSymbol(), selectedRange); System.out.println(lastData.length); if (selectedChart.equals("line")) { lineChart.getData().clear(); LinearChartManager.addSeries(lineChart, lastData, selectedRange); lineChart.setTitle(rowData.getName()); if (pointerType != null && pointerType != "hide") { OnPointerChange(); } } else { CandleChart.generateData(lastData); candleChart = new CandleChart(); CandleChart.CandleStickChart chart = candleChart.createChart(); chart.setTitle(rowData.getName()); pane.getStylesheets().add("resources/css/CandleStickChart.css"); borderPane.setCenter(chart); } } catch (Exception ex) { System.out.println("Error while downloading indicise " + ex.toString()); } } }); return row; }); //table.setItems(initRows()); table.setEditable(false); VBox vBox = (VBox) pane; //Panel dla wykresu i przyciskw konfiguracyjnych borderPane = new BorderPane(); //Po rodku wykres borderPane.setCenter(lineChart); //Na prawo przyciski konfiguracyjne borderPane.setRight(addMenuButtons()); //Dodanie do panelu widoku tabelki vBox.getChildren().add(table); //Dodanie do panelu widoku panelu z wykresem i przyciskami konfiguracyjnymi vBox.getChildren().add(borderPane); }
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 www . j a v a 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:eu.over9000.skadi.ui.MainWindow.java
@Override public void start(final Stage stage) throws Exception { this.stage = stage; this.detailPane = new ChannelDetailPane(this); this.bp = new BorderPane(); this.sp = new SplitPane(); this.sb = new StatusBar(); this.setupTable(); this.setupToolbar(stage); this.sp.getItems().add(this.table); this.bp.setTop(this.tb); this.bp.setCenter(this.sp); this.bp.setBottom(this.sb); final Scene scene = new Scene(this.bp, 1280, 720); scene.getStylesheets().add(this.getClass().getResource("/styles/copyable-label.css").toExternalForm()); scene.setOnDragOver(event -> {//from w ww. j a v a2s .c o m final Dragboard d = event.getDragboard(); if (d.hasUrl() || d.hasString()) { event.acceptTransferModes(TransferMode.COPY); } else { event.consume(); } }); scene.setOnDragDropped(event -> { final Dragboard d = event.getDragboard(); boolean success = false; if (d.hasUrl()) { final String user = StringUtil.extractUsernameFromURL(d.getUrl()); if (user != null) { success = this.channelHandler.addChannel(user, this.sb); } else { this.sb.setText("dragged url is no twitch stream"); } } else if (d.hasString()) { success = this.channelHandler.addChannel(d.getString(), this.sb); } event.setDropCompleted(success); event.consume(); }); stage.setTitle("Skadi"); stage.getIcons().add(new Image(this.getClass().getResourceAsStream("/icons/skadi.png"))); stage.setScene(scene); stage.show(); stage.iconifiedProperty().addListener((obs, oldV, newV) -> { if (this.currentState.isMinimizeToTray()) { if (newV) { stage.hide(); } } }); stage.setOnCloseRequest(event -> Platform.exit()); this.bindColumnWidths(); }
From source file:ijfx.ui.canvas.FxCanvasTester.java
@Override public void start(Stage primaryStage) { final SCIFIO scifio = new SCIFIO(); MenuBar menuBar = new MenuBar(); InputControl parameterInput = null;//from w w w .j av a 2s. c om try { System.setProperty("imagej.legacy.sync", "true"); //reader.getContext().inject(this); ImageJ imagej = new ImageJ(); context = imagej.getContext(); CommandInfo command = imagej.command().getCommand(GaussianBlur.class); CommandModuleItem input = command.getInput("sigma"); Class<?> type = input.getType(); if (type == double.class) { type = Double.class; } context.inject(this); GaussianBlur module = new GaussianBlur(); imagej.ui().showUI(); //reader = scifio.initializer().initializeReader("./stack.tif"); commandService.run(OpenFile.class, true, new HashMap<String, Object>()); menuBar = new MenuBar(); menuService.createMenus(new FxMenuCreator(), menuBar); ObjectMapper mapper = new ObjectMapper(); SimpleModule simpleModule = new SimpleModule("ModuleSerializer"); // simpleModule.addSerializer(ModuleItem<?>.class,new ModuleItemSerializer()); simpleModule.addSerializer(ModuleInfo.class, new ModuleSerializer()); simpleModule.addSerializer(ModuleItem.class, new ModuleItemSerializer()); mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.registerModule(simpleModule); mapper.writeValue(new File("modules.json"), moduleService.getModules()); } catch (Exception ex) { ImageJFX.getLogger(); } //imageView.fitImageToScreen(); Button reset = new Button("Reset"); reset.setOnAction(event -> update()); BorderPane pane = new BorderPane(); Button test = new Button("Test"); AnchorPane root = new AnchorPane(); root.getChildren().add(pane); root.getStylesheets().add(ArcMenu.class.getResource("arc-default.css").toExternalForm()); root.getStylesheets().add(ImageJFX.class.getResource(("flatterfx.css")).toExternalForm()); AnchorPane.setTopAnchor(pane, 0.0); AnchorPane.setBottomAnchor(pane, 0.0); AnchorPane.setLeftAnchor(pane, 0.0); AnchorPane.setRightAnchor(pane, 0.0); pane.setTop(menuBar); HBox vbox = new HBox(); vbox.getChildren().addAll(reset, test, parameterInput); vbox.setSpacing(10); vbox.setPadding(new Insets(10, 10, 10, 10)); // update(); pane.setCenter(ImageWindowContainer.getInstance()); // pane.setPrefSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); pane.setBottom(vbox); Scene scene = new Scene(root, 600, 600); test.setOnAction(event -> { test(); }); primaryStage.setTitle("ImageCanvasTest"); primaryStage.setScene(scene); primaryStage.show(); }
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 w w w . j av a 2s .com*/ 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:com.bdb.weather.display.freeplot.FreePlot.java
/** * Create the panel that allows the user to select what series are displayed * //from ww w. jav a 2s.c om * @param controls The series display controls * * @return The JavaFX Node */ private Node createDataSelectionPanel(Collection<SeriesGroupControl> controls) { BorderPane p = new BorderPane(); VBox box = new VBox(); Button b = new Button(LOAD_DATA_BUTTON); b.setOnAction((event) -> { loadData(); displayData(); }); //b.setActionCommand(LOAD_DATA_BUTTON); //b.setAlignmentX(JComponent.LEFT_ALIGNMENT); box.getChildren().add(b); for (SeriesGroupControl control : controls) { Node collectionPanel = control; box.getChildren().add(collectionPanel); } //box.getChildren().add(VBox.createVerticalGlue()); p.setTop(box); p.setCenter(new FlowPane()); return p; }
From source file:cz.lbenda.dataman.rc.DatamanApp.java
public void prepareMainPane() { mainPane = new BorderPane(); mainPane.setId("mainPane"); mainPane.setMaxHeight(-1);/*from w ww. java 2 s.c o m*/ mainPane.setMaxWidth(-1); mainPane.setMinHeight(-1); mainPane.setMinWidth(-1); mainPane.setPrefHeight(800.0); mainPane.setPrefWidth(1024.0); mainPane.getStyleClass().add("background"); mainPane.setBottom(statusBar); mainPane.setTop(ribbon); SplitPane spHorizontal = new SplitPane(); spHorizontal.setOrientation(Orientation.HORIZONTAL); SplitPane spVertical = new SplitPane(); spVertical.setOrientation(Orientation.VERTICAL); spHorizontal.getItems().addAll(leftPane, spVertical, rightPane); spHorizontal.setDividerPositions(0.1f, 0.8f, 0.1f); spVertical.getItems().addAll(centerPane, detailTabs); spVertical.setDividerPositions(0.8f, 0.2f); mainPane.setCenter(spHorizontal); centerPane.getChildren().add(centerTabs); centerTabs.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { Node n = newValue.getContent(); if (n instanceof DataTableView) { tableViewObjectProperty.setValue((DataTableView) n); sqlQueryRowsObjectProperty.setValue(((DataTableView) n).getSqlQueryRows()); } else { tableViewObjectProperty.setValue(null); sqlQueryRowsObjectProperty.setValue(null); } }); detailTabs.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { Node n = newValue.getContent(); if (n instanceof DataTableView) { sqlQueryRowsObjectProperty.setValue(((DataTableView) n).getSqlQueryRows()); } else { sqlQueryRowsObjectProperty.setValue(null); } }); }
From source file:be.makercafe.apps.makerbench.editors.JFXScadEditor.java
public JFXScadEditor(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 av a 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()); } }); if (path == null) { this.caCodeArea.replaceText("CSG cube = new Cube(2).toCSG()\n" + "CSG sphere = new Sphere(1.25).toCSG()\n" + "\n" + "cube.difference(sphere)"); } else { try { this.caCodeArea.replaceText(FileUtils.readFileToString(path.toFile())); } catch (IOException ex) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error reading file.", ex); } } //editorContainer.setCenter(this.codeArea); subScene = new SubScene(viewGroup, 100, 100, true, SceneAntialiasing.BALANCED); subScene.widthProperty().bind(viewContainer.widthProperty()); subScene.heightProperty().bind(viewContainer.heightProperty()); PerspectiveCamera subSceneCamera = new PerspectiveCamera(false); subScene.setCamera(subSceneCamera); viewContainer.getChildren().add(subScene); SplitPane editorPane = new SplitPane(caCodeArea, viewContainer); editorPane.setOrientation(Orientation.HORIZONTAL); BorderPane rootPane = new BorderPane(); BorderPane pane = (BorderPane) this.getTab().getContent(); toolBar = createToolBar(); rootPane.setTop(toolBar); rootPane.setCenter(editorPane); this.getTab().setContent(rootPane); subScene.setOnScroll(new EventHandler<ScrollEvent>() { @Override public void handle(ScrollEvent event) { System.out .println(String.format("deltaX: %.3f deltaY: %.3f", event.getDeltaX(), event.getDeltaY())); double z = subSceneCamera.getTranslateZ(); double newZ = z + event.getDeltaY(); subSceneCamera.setTranslateZ(newZ); } }); }