Java Code Examples for javafx.scene.layout.BorderPane#setPrefSize()
The following examples show how to use
javafx.scene.layout.BorderPane#setPrefSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartViewerSkin.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates the node representing this control. * * @return The node. */ private BorderPane createNode(ChartViewer control) { BorderPane borderPane = new BorderPane(); borderPane.setPrefSize(800, 500); StackPane sp = new StackPane(); sp.setMinSize(10, 10); sp.setPrefSize(600, 400); this.canvas = new ChartCanvas(getSkinnable().getChart()); this.canvas.setTooltipEnabled(control.isTooltipEnabled()); this.canvas.addChartMouseListener(control); this.canvas.widthProperty().bind(sp.widthProperty()); this.canvas.heightProperty().bind(sp.heightProperty()); this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); sp.getChildren().add(this.canvas); borderPane.setCenter(sp); return borderPane; }
Example 2
Source File: ChartViewerSkin.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates the node representing this control. * * @return The node. */ private BorderPane createNode(ChartViewer control) { BorderPane borderPane = new BorderPane(); borderPane.setPrefSize(800, 500); StackPane sp = new StackPane(); sp.setMinSize(10, 10); sp.setPrefSize(600, 400); this.canvas = new ChartCanvas(getSkinnable().getChart()); this.canvas.setTooltipEnabled(control.isTooltipEnabled()); this.canvas.addChartMouseListener(control); this.canvas.widthProperty().bind(sp.widthProperty()); this.canvas.heightProperty().bind(sp.heightProperty()); this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); sp.getChildren().add(this.canvas); borderPane.setCenter(sp); return borderPane; }
Example 3
Source File: ChartViewerSkin.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates the node representing this control. * * @return The node. */ private BorderPane createNode(ChartViewer control) { BorderPane borderPane = new BorderPane(); borderPane.setPrefSize(800, 500); StackPane sp = new StackPane(); sp.setMinSize(10, 10); sp.setPrefSize(600, 400); this.canvas = new ChartCanvas(getSkinnable().getChart()); this.canvas.setTooltipEnabled(control.isTooltipEnabled()); this.canvas.addChartMouseListener(control); this.canvas.widthProperty().bind(sp.widthProperty()); this.canvas.heightProperty().bind(sp.heightProperty()); this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); sp.getChildren().add(this.canvas); borderPane.setCenter(sp); return borderPane; }
Example 4
Source File: ImageEditingApp.java From FXTutorials with MIT License | 6 votes |
private Parent createContent() { BorderPane root = new BorderPane(); root.setPrefSize(800, 600); ImageView view1 = new ImageView(new Image("https://placekitten.com/400/550", true)); ImageView view2 = new ImageView(); MenuBar bar = new MenuBar(); Menu menu = new Menu("Filter..."); filters.forEach(filter -> { MenuItem item = new MenuItem(filter.name); item.setOnAction(e -> { view2.setImage(filter.apply(view1.getImage())); }); menu.getItems().add(item); }); bar.getMenus().add(menu); root.setTop(bar); root.setCenter(new HBox(view1, view2)); return root; }
Example 5
Source File: ChartViewerSkin.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates the node representing this control. * * @return The node. */ private BorderPane createNode(ChartViewer control) { BorderPane borderPane = new BorderPane(); borderPane.setPrefSize(800, 500); StackPane sp = new StackPane(); sp.setMinSize(10, 10); sp.setPrefSize(600, 400); this.canvas = new ChartCanvas(getSkinnable().getChart()); this.canvas.setTooltipEnabled(control.isTooltipEnabled()); this.canvas.addChartMouseListener(control); this.canvas.widthProperty().bind(sp.widthProperty()); this.canvas.heightProperty().bind(sp.heightProperty()); this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); sp.getChildren().add(this.canvas); borderPane.setCenter(sp); return borderPane; }
Example 6
Source File: ChartViewerSkin.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates the node representing this control. * * @return The node. */ private BorderPane createNode(ChartViewer control) { BorderPane borderPane = new BorderPane(); borderPane.setPrefSize(800, 500); StackPane sp = new StackPane(); sp.setMinSize(10, 10); sp.setPrefSize(600, 400); this.canvas = new ChartCanvas(getSkinnable().getChart()); this.canvas.setTooltipEnabled(control.isTooltipEnabled()); this.canvas.addChartMouseListener(control); this.canvas.widthProperty().bind(sp.widthProperty()); this.canvas.heightProperty().bind(sp.heightProperty()); this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); sp.getChildren().add(this.canvas); borderPane.setCenter(sp); return borderPane; }
Example 7
Source File: ChartViewerSkin.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Creates the node representing this control. * * @return The node. */ private BorderPane createNode(ChartViewer control) { BorderPane borderPane = new BorderPane(); borderPane.setPrefSize(800, 500); StackPane sp = new StackPane(); sp.setMinSize(10, 10); sp.setPrefSize(600, 400); this.canvas = new ChartCanvas(getSkinnable().getChart()); this.canvas.setTooltipEnabled(control.isTooltipEnabled()); this.canvas.addChartMouseListener(control); this.canvas.widthProperty().bind(sp.widthProperty()); this.canvas.heightProperty().bind(sp.heightProperty()); this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); sp.getChildren().add(this.canvas); borderPane.setCenter(sp); return borderPane; }
Example 8
Source File: BorderPaneSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { StackPane sp = new StackPane(); BorderPane borderPane = new BorderPane(); Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY); rectangle.setStroke(Color.BLACK); borderPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight()); Rectangle recTop = new Rectangle(62, 5, Color.web("#349b00")); recTop.setStroke(Color.BLACK); Rectangle recBottom = new Rectangle(62, 14, Color.web("#349b00")); recBottom.setStroke(Color.BLACK); Rectangle recLeft = new Rectangle(20, 41, Color.TRANSPARENT); recLeft.setStroke(Color.BLACK); Rectangle recRight = new Rectangle(20, 41, Color.TRANSPARENT); recRight.setStroke(Color.BLACK); Rectangle centerRight = new Rectangle(20, 41, Color.TRANSPARENT); centerRight.setStroke(Color.BLACK); borderPane.setRight(recRight); borderPane.setTop(recTop); borderPane.setLeft(recLeft); borderPane.setBottom(recBottom); borderPane.setCenter(centerRight); sp.getChildren().addAll(rectangle, borderPane); return new Group(sp); }
Example 9
Source File: MarathonCheckListStage.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Parent getContentPane() { BorderPane pane = new BorderPane(); pane.setCenter(splitPane); pane.setBottom(buttonBar); pane.setPrefSize(750, 600); return pane; }
Example 10
Source File: FunctionStage.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Parent getContentPane() { BorderPane content = new BorderPane(); content.getStyleClass().add("function-stage"); content.setId("functionStage"); content.setCenter(mainSplitPane); content.setBottom(buttonBar); content.setPrefSize(700, 500); return content; }
Example 11
Source File: AnnotateScreenCapture.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Parent getContentPane() { BorderPane borderPane = new BorderPane(); borderPane.setCenter(imagePanel); borderPane.setBottom(buttonBar); Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds(); borderPane.setPrefSize(visualBounds.getWidth() * 0.75, visualBounds.getHeight() * 0.75); return borderPane; }
Example 12
Source File: BorderPaneSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { StackPane sp = new StackPane(); BorderPane borderPane = new BorderPane(); Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY); rectangle.setStroke(Color.BLACK); borderPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight()); Rectangle recTop = new Rectangle(62, 5, Color.web("#349b00")); recTop.setStroke(Color.BLACK); Rectangle recBottom = new Rectangle(62, 14, Color.web("#349b00")); recBottom.setStroke(Color.BLACK); Rectangle recLeft = new Rectangle(20, 41, Color.TRANSPARENT); recLeft.setStroke(Color.BLACK); Rectangle recRight = new Rectangle(20, 41, Color.TRANSPARENT); recRight.setStroke(Color.BLACK); Rectangle centerRight = new Rectangle(20, 41, Color.TRANSPARENT); centerRight.setStroke(Color.BLACK); borderPane.setRight(recRight); borderPane.setTop(recTop); borderPane.setLeft(recLeft); borderPane.setBottom(recBottom); borderPane.setCenter(centerRight); sp.getChildren().addAll(rectangle, borderPane); return new Group(sp); }
Example 13
Source File: MirrorScanWindowFX.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
/** * Create the frame. */ public MirrorScanWindowFX() { contentPane = new BorderPane(); contentPane.setStyle("-fx-border-width: 5;"); contentPane.setPrefSize(800, 800); this.setScene(new Scene(contentPane)); }
Example 14
Source File: ParetoPanel.java From charts with Apache License 2.0 | 4 votes |
private void init() { modelStack = new Stack<>(); dataDots = new ArrayList<>(); popup = new ParetoInfoPopup(); mouseHandler = this::handleMouseEvents; modelStack.push(paretoModel); _labelingColor = Color.BLACK; _singelSubBarCentered = true; initGraphics(); registerListeners(); colorThemes = new HashMap<>(); ArrayList<Color> defaultColorTheme = new ArrayList<>(); defaultColorTheme.add(Color.BLUE); colorThemes.putIfAbsent("Default", defaultColorTheme); _valueFontYPosition = 20; _identifierFontYPosition = 40; _pathFontYPositon = 65; _percentageLineDataDotColor = Color.BLACK; _percentageLineColor = Color.BLACK; _useCalculatedSubBarColors = true; _smoothPercentageCurve = false; _showSubBars = true; textPane = new AnchorPane(); yAxisLeft = Helper.createLeftAxis(0, paretoModel.getTotal(), false, 80d); yAxisRight = Helper.createRightAxis(0,100,true,80d); maxValue = new DoublePropertyBase(paretoModel.getTotal()) { @Override public Object getBean() { return ParetoPanel.this; } @Override public String getName() { return "maxValue"; } }; yAxisLeft.setTitle(paretoModel.getTitle()); yAxisLeft.setTitleFontSize(30); //yAxisRight.setTitle("Percentage"); //title written into the numbers of scale yAxisRight.setTitleFontSize(30); yAxisRight.setUnit("\\u0025"); yAxisLeft.maxValueProperty().bindBidirectional(maxValue); yAxisRight.setPosition(Position.CENTER); bPane = new BorderPane(); bPane.setPrefWidth(yAxisRight.getWidth()+ canvas.getWidth()+ yAxisRight.getWidth()); bPane.setCenter(canvas); yAxisRightProperty = new ObjectPropertyBase<Axis>(yAxisRight) { @Override public Object getBean() { return ParetoPanel.this; } @Override public String getName() { return "yAxisRight"; } }; yAxisLeftProperty = new ObjectPropertyBase<Axis>(yAxisLeft) { @Override public Object getBean() { return ParetoPanel.this; } @Override public String getName() { return "yAxisLeft"; } }; bPane.rightProperty().bind(yAxisRightProperty); bPane.leftProperty().bind(yAxisLeftProperty); _barSpacing = 5; width = getWidth() - getInsets().getLeft() - getInsets().getRight(); height = getHeight() - getInsets().getTop() - getInsets().getBottom(); bPane.setMaxSize(width, height); bPane.setPrefSize(width, height); canvas.setWidth(width-yAxisRight.getWidth()-yAxisLeft.getWidth()); textPane.setMaxHeight(80); textPane.setMinHeight(80); StackPane test = new StackPane(); test.setPrefHeight(80d); labelingCanvas = new Canvas(); labelingCanvas.setHeight(80); labelingCtx = labelingCanvas.getGraphicsContext2D(); delayRedraw = false; bPane.setBottom(labelingCanvas); getChildren().setAll(bPane); drawParetoChart(); }
Example 15
Source File: MainWindow.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 4 votes |
MainWindow() { fileEditorTabPane = new FileEditorTabPane(this); fileEditorManager = new FileEditorManager(fileEditorTabPane); projectPane = new ProjectPane(fileEditorManager); Preferences state = MarkdownWriterFXApp.getState(); double dividerPosition = state.getDouble("projectPaneDividerPosition", 0.2); SplitPane splitPane = new SplitPane(projectPane.getNode(), fileEditorTabPane.getNode()) { private int layoutCount; @Override protected void layoutChildren() { super.layoutChildren(); if (layoutCount < 2) { layoutCount++; setDividerPosition(0, dividerPosition); super.layoutChildren(); } } }; SplitPane.setResizableWithParent(projectPane.getNode(), false); splitPane.setDividerPosition(0, dividerPosition); splitPane.getDividers().get(0).positionProperty().addListener((ob, o, n) -> { Utils.putPrefsDouble(state, "projectPaneDividerPosition", n.doubleValue(), 0.2); }); BorderPane borderPane = new BorderPane(); borderPane.getStyleClass().add("main"); borderPane.setPrefSize(800, 800); borderPane.setTop(createMenuBarAndToolBar()); borderPane.setCenter(splitPane); scene = new Scene(borderPane); scene.getStylesheets().add("org/markdownwriterfx/MarkdownWriter.css"); scene.windowProperty().addListener((observable, oldWindow, newWindow) -> { newWindow.setOnCloseRequest(e -> { if (!fileEditorTabPane.canCloseAllEditos()) e.consume(); }); // workaround for a bug in JavaFX: unselect menubar if window looses focus newWindow.focusedProperty().addListener((obs, oldFocused, newFocused) -> { if (!newFocused) { // send an ESC key event to the menubar menuBar.fireEvent(new KeyEvent(KeyEvent.KEY_PRESSED, KeyEvent.CHAR_UNDEFINED, "", KeyCode.ESCAPE, false, false, false, false)); } }); }); Utils.fixSpaceAfterDeadKey(scene); // workaround for a bad JavaFX behavior: menu bar always grabs focus when ALT key is pressed, // but should grab it when ALT key is releases (as all other UI toolkits do) to give other // controls the chance to use Alt+Key shortcuts. scene.addEventHandler(KeyEvent.KEY_PRESSED, e -> { if (e.isAltDown()) e.consume(); }); // open markdown files dropped to main window scene.setOnDragOver(e -> { if (e.getDragboard().hasFiles()) e.acceptTransferModes(TransferMode.COPY); e.consume(); }); scene.setOnDragDropped(e -> { boolean success = false; if (e.getDragboard().hasFiles()) { fileEditorTabPane.openEditors(e.getDragboard().getFiles(), 0, -1); success = true; } e.setDropCompleted(success); e.consume(); }); Platform.runLater(() -> stageFocusedProperty.bind(scene.getWindow().focusedProperty())); }
Example 16
Source File: GenerateCodeDialog.java From tcMenu with Apache License 2.0 | 4 votes |
public void showCodeGenerator(Stage stage, boolean modal) { this.mainStage = stage; VBox vbox = new VBox(5); placeDirectoryAndEmbeddedPanels(vbox); filterChoicesByPlatform(platformCombo.getValue()); addTitleLabel(vbox, "Select the input type:"); CodeGeneratorOptions genOptions = project.getGeneratorOptions(); CodePluginItem itemInput = findItemByUuidOrDefault(inputsSupported, genOptions.getLastInputUuid()); currentInput = new UICodePluginItem(manager, itemInput, CHANGE, this::onInputChange); currentInput.setId("currentInputUI"); currentInput.getStyleClass().add("uiCodeGen"); vbox.getChildren().add(currentInput); addTitleLabel(vbox, "Select the display type:"); CodePluginItem itemDisplay = findItemByUuidOrDefault(displaysSupported, genOptions.getLastDisplayUuid()); currentDisplay = new UICodePluginItem(manager, itemDisplay, CHANGE, this::onDisplayChange); currentDisplay.setId("currentDisplayUI"); currentDisplay.getStyleClass().add("uiCodeGen"); vbox.getChildren().add(currentDisplay); addTitleLabel(vbox, "Select remote capabilities:"); CodePluginItem itemRemote = findItemByUuidOrDefault(remotesSupported, genOptions.getLastRemoteCapabilitiesUuid()); currentRemote = new UICodePluginItem(manager, itemRemote, CHANGE, this::onRemoteChange); currentRemote.setId("currentRemoteUI"); currentRemote.getStyleClass().add("uiCodeGen"); vbox.getChildren().add(currentRemote); buildTable(); ButtonBar buttonBar = new ButtonBar(); generateButton = new Button("Generate Code"); generateButton.setDefaultButton(true); generateButton.setOnAction(this::onGenerateCode); generateButton.setId("GenerateButton"); cancelButton = new Button("Cancel"); cancelButton.setCancelButton(true); cancelButton.setOnAction(this::onCancel); buttonBar.getButtons().addAll(generateButton, cancelButton); BorderPane root = new BorderPane(); root.setTop(vbox); root.setOpaqueInsets(new Insets(5)); root.setCenter(propsTable); root.setBottom(buttonBar); root.setPrefSize(800, 750); BorderPane.setMargin(propsTable, new Insets(5)); BorderPane.setMargin(buttonBar, new Insets(5)); BorderPane.setMargin(vbox, new Insets(5)); var title = "Code Generator:" + project.getFileName(); createDialogStateAndShowSceneAdj(stage, root, title, modal, (scene, dlgStg) -> { scene.getStylesheets().add(UiHelper.class.getResource("/ui/JMetroDarkTheme.css").toExternalForm()); dialogStage = dlgStg; }); }
Example 17
Source File: MainPane.java From oim-fx with MIT License | 4 votes |
public MainPane() { findTextField.getStyleClass().clear(); findTextField.setBackground(Background.EMPTY); findTextField.setStyle("-fx-text-fill: #ffffff;-fx-prompt-text-fill: #a9a9a9;-fx-text-font-size: 14px;"); HBox findHBox = new HBox(); findHBox.setAlignment(Pos.CENTER_LEFT); findHBox.getChildren().add(findImageView); BorderPane findBorderPane=new BorderPane(); findBorderPane.setStyle("-fx-background-color:#26292e"); findBorderPane.setPrefSize(245, 30); findBorderPane.setLeft(findHBox); findBorderPane.setCenter(findTextField); VBox findVBox = new VBox(); findVBox.setAlignment(Pos.CENTER); findVBox.setPadding(new Insets(5, 10, 5, 10)); findVBox.getChildren().add(findBorderPane); topVBox.getChildren().add(personalPane); topVBox.getChildren().add(findVBox); final StackPane centerStackPane = new StackPane(); centerStackPane.getChildren().add(tabPanel); centerStackPane.getChildren().add(findListPane); leftBorderPane.setPrefWidth(280); leftBorderPane.setTop(topVBox); leftBorderPane.setCenter(centerStackPane); leftBorderPane.setStyle("-fx-background-color:#2e3238;"); this.setPrefHeight(600); this.setLeft(leftBorderPane); tabPanel.setVisible(true); findListPane.setVisible(false); initEvent(); initTest(); //tabPanel.setSide(Side.RIGHT); tabPanel.setTabSize(45); }
Example 18
Source File: SpectraIdentificationResultsWindowFX.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public SpectraIdentificationResultsWindowFX() { super(); pnMain = new BorderPane(); this.setScene(new Scene(pnMain)); getScene().getStylesheets() .addAll(MZmineCore.getDesktop().getMainWindow().getScene().getStylesheets()); pnMain.setPrefSize(1000, 600); pnMain.setMinSize(700, 500); setMinWidth(700); setMinHeight(500); setTitle("Processing..."); pnGrid = new GridPane(); // any number of rows noMatchesFound = new Label("I'm working on it"); noMatchesFound.setFont(headerFont); // yellow noMatchesFound.setTextFill(Color.web("0xFFCC00")); pnGrid.add(noMatchesFound, 0, 0); pnGrid.setVgap(5); // Add the Windows menu MenuBar menuBar = new MenuBar(); // menuBar.add(new WindowsMenu()); Menu menu = new Menu("Menu"); // set font size of chart MenuItem btnSetup = new MenuItem("Setup dialog"); btnSetup.setOnAction(e -> { Platform.runLater(() -> { if (MZmineCore.getConfiguration() .getModuleParameters(SpectraIdentificationResultsModule.class) .showSetupDialog(true) == ExitCode.OK) { showExportButtonsChanged(); } }); }); menu.getItems().add(btnSetup); CheckMenuItem cbCoupleZoomY = new CheckMenuItem("Couple y-zoom"); cbCoupleZoomY.setSelected(true); cbCoupleZoomY.setOnAction(e -> setCoupleZoomY(cbCoupleZoomY.isSelected())); menu.getItems().add(cbCoupleZoomY); menuBar.getMenus().add(menu); pnMain.setTop(menuBar); scrollPane = new ScrollPane(pnGrid); pnMain.setCenter(scrollPane); scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); totalMatches = new ArrayList<>(); matchPanels = new HashMap<>(); setCoupleZoomY(true); show(); }