@Test public void getText() { SplitPane splitPane = (SplitPane) getPrimaryStage().getScene().getRoot().lookup(".split-pane"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(() -> { RFXSplitPane rfxSplitPane = new RFXSplitPane(splitPane, null, null, lr); splitPane.setDividerPosition(0, 0.6); rfxSplitPane.mouseReleased(null); text.add(rfxSplitPane.getAttribute("text")); }); new Wait("Waiting for split pane text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("[0.6,0.6008064516129032]", text.get(0)); }
private void initComponents() { LOGGER_UI.trace(":initComps"); reqTableView = new RequirementTableView(); reqTableView.setOnAdd(handler::handleCreation); reqTableView.setOnRemove(handler::handleDeletion); reqTableView.setOnModify(handler::handleModification); msView = new MilestonesListView(handler); catInfo = new CatalogueInfoPane(); splitter = new SplitPane(); splitter.prefWidthProperty().bind(widthProperty()); splitter.prefHeightProperty().bind(heightProperty()); }
private SplitPane createChartPane() { CategoryDataset3D dataset = SampleData.createCompanyRevenueDataset(); Chart3D chart = AreaChart3DFXDemo1.createChart(dataset); Chart3DViewer viewer = new Chart3DViewer(chart); this.splitter = new SplitPane(); splitter.setOrientation(Orientation.VERTICAL); final BorderPane borderPane = new BorderPane(); borderPane.setCenter(viewer); // Bind canvas size to stack pane size. viewer.prefWidthProperty().bind(borderPane.widthProperty()); viewer.prefHeightProperty().bind(borderPane.heightProperty()); final StackPane sp2 = new StackPane(); this.chartDescription = new WebView(); WebEngine webEngine = chartDescription.getEngine(); webEngine.load(AreaChart3DFXDemo1.class.getResource("AreaChart3DFXDemo1.html").toString()); sp2.getChildren().add(chartDescription); splitter.getItems().addAll(borderPane, sp2); splitter.setDividerPositions(0.70f, 0.30f); return splitter; }
public TablePanel(UIProperties uiProperties, MessageByLocaleService localeService, MainController controller) { this.controller = controller; setPrefHeight(uiProperties.getTablesPrefHeight()); setPrefWidth(uiProperties.getTablesPrefWidth()); buttons = new TableButtons(); tableListView = new TableListView(); tableListView.onMouseClick(buttons::enableButtons, buttons::disableButtons); tableListView.setOnContextMenuRequested(this::onTableContextMenu); SplitPane splitPane = splitPane(uiProperties); UIUtil.fillParent(splitPane); getChildren().add(splitPane); tableContext = new TableListContext(localeService, this::tryLoadDDL, this::tryLoadData); }
private Pane createExtractedTableTextArea(ConstraintSpecification spec, ConstraintSpecificationValidator recognizer) { final TextArea textArea = new TextArea(); textArea.getStyleClass().addAll("model-text-area"); textArea.setEditable(false); updateText(textArea, spec); final Button updateButton = new Button("Refresh"); updateButton.setOnAction(event -> updateText(textArea, spec)); final TextArea problemsArea = new TextArea(); problemsArea.getStyleClass().addAll("model-text-area"); textArea.setEditable(false); updateProblemsText(problemsArea, recognizer); recognizer.problemsProperty().addListener((Observable o) -> updateProblemsText(problemsArea, recognizer)); SplitPane splitPane = new SplitPane(textArea, problemsArea); splitPane.setOrientation(Orientation.VERTICAL); VBox.setVgrow(splitPane, Priority.ALWAYS); return new VBox(updateButton, splitPane); }
private Node createExtractedVarsTextArea(VariableCollectionController controller, FreeVariableListValidator validator) { final TextArea textArea = new TextArea(); textArea.getStyleClass().addAll("model-text-area"); textArea.setEditable(false); FreeVariableList set = controller.getFreeVariableList(); updateText(textArea, set.getVariables()); set.getVariables().addListener((ListChangeListener<? super FreeVariable>) c -> updateText(textArea, set.getVariables())); final TextArea problemsArea = new TextArea(); problemsArea.getStyleClass().addAll("model-text-area"); textArea.setEditable(false); updateProblemsText(problemsArea, validator); validator.problemsProperty().addListener((Observable o) -> updateProblemsText(problemsArea, validator)); SplitPane splitPane = new SplitPane(textArea, problemsArea); splitPane.setOrientation(Orientation.VERTICAL); return splitPane; }
/** * laedt eine FXML auf die stage , welche nach auswahl einer Uebung erscheint * layout beeinhaltet save buttons und textareas und eine men�bar mit verschiedenen optionen */ public static void initTDDTrainerViewNormalMode(String testcode,String sourcecode) { //komisch gemacht doch die textarea laesst sich veraendern beim start try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(TDDTMain.class.getResource("layout/TDDTrainerViewNormalMode.fxml")); tddtrainerview = (BorderPane) loader.load(); SplitPane splitpanewithtextareas = (SplitPane) tddtrainerview.getChildren().get(1); AnchorPane anchorpanewithsourcecodearea = (AnchorPane) splitpanewithtextareas.getItems().get(0); AnchorPane anchorpanewithtestcodearea = (AnchorPane) splitpanewithtextareas.getItems().get(1); TextArea textareasourcecode = (TextArea) anchorpanewithsourcecodearea.getChildren().get(0); TextArea textareatestcode = (TextArea) anchorpanewithtestcodearea.getChildren().get(0); textareatestcode.setText(testcode); textareasourcecode.setText(sourcecode); scene = new Scene(tddtrainerview); primarystage.setScene(scene); primarystage.show(); } catch(IOException e) { e.printStackTrace(); } }
public MainPane() { detailPane = new CPane(); table = new FxTable(); table.addColumn("Example"); table.setResizePolicyConstrained(); table.getItems().setAll(AllPages.get()); table.selectedItemProperty().addListener((s) -> updateSelection()); split = new SplitPane(table, detailPane); split.setOrientation(Orientation.HORIZONTAL); setCenter(split); table.selectFirst(); }
private static void restoreSplitPane(String prefix, SplitPane sp) { String k = prefix + SFX_DIVIDERS; SStream s = GlobalSettings.getStream(k); // must run later because of FX split pane inability to set divider positions exactly FX.later(() -> { int ct = s.nextInt(); if(sp.getDividers().size() == ct) { for(int i=0; i<ct; i++) { double div = s.nextDouble(); sp.setDividerPosition(i, div); } } }); }
@Override public void start(Stage primaryStage) throws Exception { CheckBoxFxControlTreeView checkedNodeTreeView = new CheckBoxFxControlTreeView(getTestNod()); checkedNodeTreeView.setOnMouseClicked(event -> { System.out.println(checkedNodeTreeView.getCheckModel().getCheckedItems()); }); FxControlTreeView simpleNodeTreeView = new FxControlTreeView(getTestNod()); simpleNodeTreeView.setOnMouseClicked(event -> { System.out.println(simpleNodeTreeView.getSelectionModel().getSelectedItems()); }); Scene scene = new Scene(new SplitPane(simpleNodeTreeView, checkedNodeTreeView)); primaryStage.setScene(scene); primaryStage.show(); }
public PMDCheckComposite(File sourceFile) { this.sourceFile = sourceFile; javaTextArea = new JavaTextArea(); xmlEditor = new XMLEditor(); SplitPane splitPane = new SplitPane(javaTextArea, xmlEditor); splitPane.setOrientation(Orientation.VERTICAL); splitPane.setDividerPositions(0.7d, 0.3d); setCenter(splitPane); violationLabel = new Label(); setBottom(violationLabel); if (this.sourceFile.isDirectory()) { dirFilePmd(this.sourceFile); } else { simpleFilePmd(this.sourceFile); } }
@Override public Node drawNode() { SplitPane split_pane = new SplitPane(); Rectangle blue_rect = new Rectangle(SLOT_WIDTH, SLOT_HEIGHT); blue_rect.setFill(new Color(0, 0, 1, 1)); Rectangle red_rect = new Rectangle(SLOT_WIDTH, SLOT_HEIGHT); red_rect.setFill(new Color(1, 0, 0, 1)); split_pane.getItems().add(blue_rect); split_pane.getItems().add(red_rect); split_pane.setMaxSize(SLOT_WIDTH, SLOT_HEIGHT); split_pane.setPrefSize(SLOT_WIDTH, SLOT_HEIGHT); split_pane.setMinSize(SLOT_WIDTH, SLOT_HEIGHT); split_pane.setStyle("-fx-border-color: darkgray;"); split_pane.setOrientation(orientation); return split_pane; }
@Override public Node drawNode() { SplitPane node = (SplitPane) createObject(); node.setDividerPositions(position); SplitPane split_pane = new SplitPane(); for (int i = 0; i < SPLITS_NUM; i++) { VBox box = new VBox(); box.setId(SPLIT_PANE_CONTENT); Label label = new Label("Split's " + i + " content"); label.setMinSize(0, 0); box.getChildren().add(label); split_pane.getItems().add(box); } for (int i = 0; i < SPLITS_NUM - 1; i++) { split_pane.setDividerPosition(i, 1.0 * (i + 1) / SPLITS_NUM); } node.setOrientation(orientation); if (node.getOrientation() != orientation) { reportGetterFailure("getOrientation()"); } return node; }
@Override public Node drawNode() { SplitPane split_pane = new SplitPane(); split_pane.setId(PARENT_SPLIT); split_pane.getItems().add(createNested()); split_pane.getItems().add(createNested()); split_pane.setOrientation(orientation); split_pane.setMaxSize(SLOT_WIDTH, SLOT_HEIGHT); split_pane.setPrefSize(SLOT_WIDTH, SLOT_HEIGHT); split_pane.setMinSize(0, 0); return split_pane; }
protected SplitPane createNested() { SplitPane nested_split_pane = (SplitPane) createObject(); nested_split_pane.setId(NESTED_SPLIT); boolean resizable = false; for (Node node : nested_split_pane.getItems()) { SplitPane.setResizableWithParent(node, resizable); if (SplitPane.isResizableWithParent(node) != resizable) { reportGetterFailure("SplitPane.isResizableWithParent(node)"); break; } resizable = !resizable; } nested_split_pane.setOrientation(orientation); nested_split_pane.setMaxSize(-1, -1); nested_split_pane.setPrefSize(-1, -1); nested_split_pane.setMinSize(-1, -1); return nested_split_pane; }
protected Object createObject(double width, double height, Double tab_width, Double tab_height) { SplitPane split_pane = new SplitPane(); for (int i = 0; i < SPLITS_NUM; i++) { VBox box = new VBox(); box.setId(SPLIT_PANE_CONTENT); Label label = new Label("Split's " + i + " content"); label.setMinSize(0, 0); box.getChildren().add(label); split_pane.getItems().add(box); } for (int i = 0; i < SPLITS_NUM - 1; i++) { split_pane.setDividerPosition(i, 1.0 * (i + 1) / SPLITS_NUM); } split_pane.setMaxSize(width, height); split_pane.setPrefSize(width, height); split_pane.setMinSize(0, 0); split_pane.setStyle("-fx-border-color: darkgray;"); return split_pane; }
protected void resizableCheck(final Wrap<? extends SplitPane> split_wrap) { Parent<Node> split_as_parent = split_wrap.as(Parent.class, Node.class); Lookup<SplitPane> split_lookup = split_as_parent.lookup(SplitPane.class, new ByID<SplitPane>(SplitPaneApp.NESTED_SPLIT)); for (int i = 0; i < split_lookup.size(); i++) { Wrap<? extends SplitPane> split = split_lookup.wrap(i); List<Wrap> split_pane_wraps = getSplitPanes(split); List<Boolean> resizable_flags = getResizableFlags(split); List<Double> initial_split_sizes = getSplitSizes(split_pane_wraps, isVertical(split)); Wrap<? extends Node> divider = split_as_parent.lookup(Node.class, new ByStyleClass<Node>("split-pane-divider") { @Override public boolean check(Node cntrl) { return super.check(cntrl) && cntrl.getParent().getId().contentEquals(SplitPaneApp.PARENT_SPLIT); } }).wrap(); Point start_point = getCenterPoint(divider.getScreenBounds()); Point end_point1 = getDragPoint1(split_wrap); Point end_point2 = getDragPoint2(split_wrap); drag(start_point, end_point1); List<Double> split_sizes = getSplitSizes(split_pane_wraps, isVertical(split)); checkSizes(initial_split_sizes, split_sizes, resizable_flags); drag(getCenterPoint(divider.getScreenBounds()), end_point2); split_sizes = getSplitSizes(split_pane_wraps, isVertical(split)); checkSizes(initial_split_sizes, split_sizes, resizable_flags); drag(getCenterPoint(divider.getScreenBounds()), start_point); } }
private void showEditorView() { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("gui/EditorView.fxml")); loader.setResources(trackingManager.bundle); SplitPane editorView = loader.load(); editorViewController = loader.getController(); centerPane.getChildren().add(editorView); AnchorPane.setBottomAnchor(editorView, 0.0); AnchorPane.setLeftAnchor(editorView, 5.0); AnchorPane.setRightAnchor(editorView, 5.0); AnchorPane.setTopAnchor(editorView, 0.0); } catch (IOException e) { e.printStackTrace(); } }
private void showEditorView() { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("EditorView.fxml")); loader.setResources(resources); SplitPane editorView = loader.load(); rootPane.getChildren().add(editorView); AnchorPane.setBottomAnchor(editorView, 0.0); AnchorPane.setLeftAnchor(editorView, 5.0); AnchorPane.setRightAnchor(editorView, 5.0); AnchorPane.setTopAnchor(editorView, 60.0); editorViewController = loader.getController(); bus.register(editorViewController); editorViewController.init(phaseManager, this); } catch (IOException e) { e.printStackTrace(); } }
@Override public void start(Stage primaryStage) { try { MQTTConnector connection = new MQTTConnector("localhost", null, null); GuiController.setConnection(connection); rootLayout = (VBox)FXMLLoader.load(getClass().getResource("application.fxml")); GuiController.setRootPane(rootLayout); //rootLayout.getChildren().get(1); SplitPane n = (SplitPane) rootLayout.getChildren().get(1); ScrollPane sp = (ScrollPane) n.getItems().get(1); // sp.setContent(value); for(Node v :n.getItems()) { System.out.println("Node node " + v); } // Show the scene containing the root layout. Scene scene = new Scene(rootLayout); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } }
/** * Constructs a new {@link ManagementConsole}. * @param database the {@link JenkinsDatabase}. */ public ManagementConsole( JenkinsDatabase database ) { NotificationTree notifications = new NotificationTree( database ); this.jobsNotificationsSplit = new SplitPane( new JobProgressTree( database ), notifications ); this.jobsNotificationsSplit.setDividerPositions( PROGRESS_DIVIDER_POSITION ); UserAssignmentsTree assignmentsTree = new UserAssignmentsTree( database ); AssignmentDetailArea detailArea = new AssignmentDetailArea(); new AssignmentDetailController( assignmentsTree, detailArea ); this.assignments = new BorderPane( assignmentsTree ); this.assignments.setRight( detailArea ); this.notificationsAssignmentsSplit = new SplitPane( jobsNotificationsSplit, assignments ); this.notificationsAssignmentsSplit.setDividerPositions( ASSIGNMENTS_DIVIDER_POSITION ); this.notificationsAssignmentsSplit.setOrientation( Orientation.VERTICAL ); setCenter( notificationsAssignmentsSplit ); }
void addRow(final int position) { SplitPane splitRow = new SplitPane(); splitRow.setOrientation(Orientation.HORIZONTAL); // For now, we create a row with the same number of columns in every row // Create viewers & bind dividers splitRow.getItems().clear(); SplitPane firstRow = splitPaneRows.get(0); splitRow.getItems().add(createViewer().getView()); for (int i = 0; i < firstRow.getDividers().size(); i++) { splitRow.getItems().add(createViewer().getView()); // splitRow.getDividers().get(i).positionProperty().bindBidirectional(firstRow.getDividers().get(i).positionProperty()); } // Ensure the new divider takes up half the space double lastDividerPosition = position == 0 ? 0 : splitPaneMain.getDividers().get(position-1).getPosition(); double nextDividerPosition = position >= splitPaneRows.size()-1 ? 1 : splitPaneMain.getDividers().get(position).getPosition(); splitPaneRows.add(position, splitRow); splitPaneMain.getItems().add(position+1, splitRow); splitPaneMain.setDividerPosition(position, (lastDividerPosition + nextDividerPosition)/2); refreshDividerBindings(); }
public void buildLayout() { getChildren().clear(); getChildren().addAll(topZone, zoneToolbar); topZone.getItems().addAll(zoneMain, zoneComponents); // zoneEdit应该放在zoneProperty上面,因为需要响应一些鼠标事件,如拖放操作 zoneMain.getChildren().addAll(zoneProperty, zoneEdit); topZone.setBackground(Background.EMPTY); zoneMain.setBackground(Background.EMPTY); // zoneToolbar.setPrefHeight(30); topZone.prefHeightProperty().bind(heightProperty().subtract(zoneToolbar.heightProperty())); zoneMain.prefWidthProperty().bind(topZone.widthProperty().subtract(zoneComponents.widthProperty())); zoneComponents.setMinWidth(200); zoneComponents.setMaxWidth(200); zoneProperty.prefHeightProperty().bind(zoneMain.heightProperty()); Jfx.runOnJfx(() -> { zoneComponents.setMinWidth(0); zoneComponents.setMaxWidth(99999); SplitPane.setResizableWithParent(zoneComponents, Boolean.FALSE); }); }
private void create() { myEditorController = new EditorController(); HierarchyTreeViewController componentTree = new HierarchyTreeViewController(myEditorController); ContentPanelController canvas = new ContentPanelController(myEditorController); InspectorPanelController propertyTable = new InspectorPanelController(myEditorController); LibraryPanelController palette = new LibraryPanelController(myEditorController); loadFile(); startChangeListener(); SplitPane leftPane = new SplitPane(); leftPane.setOrientation(Orientation.VERTICAL); leftPane.getItems().addAll(palette.getPanelRoot(), componentTree.getPanelRoot()); leftPane.setDividerPositions(0.5, 0.5); SplitPane.setResizableWithParent(leftPane, Boolean.FALSE); SplitPane.setResizableWithParent(propertyTable.getPanelRoot(), Boolean.FALSE); SplitPane mainPane = new SplitPane(); mainPane.getItems().addAll(leftPane, canvas.getPanelRoot(), propertyTable.getPanelRoot()); mainPane.setDividerPositions(0.11036789297658862, 0.8963210702341137); myPanel.setScene(new Scene(mainPane, -1, -1, true, SceneAntialiasing.BALANCED)); }
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("/home.fxml")); loader.load(); HomeController home = loader.getController(); SplitPane homeRoot = loader.getRoot(); primaryStage.setTitle("Serial Monitor"); primaryStage.setMinWidth(400); primaryStage.setMinHeight(600); primaryStage.setScene(new Scene(homeRoot)); primaryStage.setOnCloseRequest(event -> home.dispose()); primaryStage.show(); }
public static void showStage(WebView webView, SplitPane mainSplitPane) throws IOException { int webViewIndex = mainSplitPane.getItems().indexOf(webView); FXMLLoader loader = new FXMLLoader(FullScreenController.class.getResource("/fxml/fullscreen.fxml")); loader.load(); FullScreenController controller = loader.getController(); controller.borderPane.setCenter(webView); Stage stage = new Stage(StageStyle.UTILITY); stage.setFullScreenExitKeyCombination(KeyCombination.keyCombination("F11")); stage.setFullScreen(true); Scene scene = new Scene(loader.getRoot()); scene.addEventFilter(KeyEvent.KEY_PRESSED, e -> { if (e.getCode() == KeyCode.F11) { stage.close(); mainSplitPane.getItems().set(webViewIndex, webView); } }); stage.setScene(scene); stage.show(); }
/** * Creates an extensible layout around the given component. * * @param component component that shall be wrapped */ public DraggableTabLayoutExtender(@NamedArg("center") Node component) { super(component); // offer drop areas in all directions when user is dragging a tab draggingTabListener = (observable, oldTab, newTab) -> { if (lastDraggingTab != newTab) { lastDraggingTab = newTab; if (!(getParent().getParent() instanceof SplitPane && getCenter() instanceof SplitPane) && newTab != null) { DraggableTabFactory factory = DraggableTabFactory.getFactory(); setTop(factory.createInsertPane(this, Direction.UP)); setBottom(factory.createInsertPane(this, Direction.DOWN)); setLeft(factory.createInsertPane(this, Direction.LEFT)); setRight(factory.createInsertPane(this, Direction.RIGHT)); } else { setTop(null); setBottom(null); setLeft(null); setRight(null); } } }; DraggableTab.draggingTab.addListener(draggingTabListener); }
/** * Cleans up the given extender. * * @param extender extender */ public static void cleanup(DraggableTabLayoutExtender extender) { Platform.runLater(() -> { if (extender.getCenter() == null && extender.getParent() != null) { if (extender.getParent().getParent() == null) { cleanup(extender); } else { if (extender.getParent() != null && extender.getParent().getParent() != null && extender.getParent().getParent() instanceof SplitPane) { SplitPane splitPane = (SplitPane) extender.getParent().getParent(); splitPane.getItems().remove(extender); rearrangeDividers(splitPane); cleanup(splitPane); } } } }); }
/** * Cleans up the given split pane. * * @param splitPane split pane */ public static void cleanup(SplitPane splitPane) { Platform.runLater(() -> { Parent parent = splitPane.getParent(); if (splitPane.getItems().isEmpty()) { if (parent != null && parent instanceof DraggableTabLayoutExtender) { DraggableTabLayoutExtender extender = (DraggableTabLayoutExtender) parent; extender.setCenter(null); cleanup(extender); } } else if (splitPane.getItems().size() == 1) { Node node = splitPane.getItems().get(0); if (parent != null && parent.getParent() != null && parent.getParent().getParent() != null) { if (parent.getParent().getParent() instanceof SplitPane) { SplitPane parentSplitPane = (SplitPane) parent.getParent().getParent(); splitPane.getItems().remove(node); int i = parentSplitPane.getItems().indexOf(parent); parentSplitPane.getItems().add(i, node); cleanup(splitPane); } } } }); }
public DraggableTabStage(SplitPane splitPane) { // close window automatically when last tab gets removed splitPane.getItems().addListener((InvalidationListener) observable -> { Platform.runLater(() -> { if (splitPane.getItems().isEmpty()) { close(); } }); }); Scene scene = new Scene(splitPane); setScene(scene); // place window centered under the cursor Point p = MouseInfo.getPointerInfo().getLocation(); setX(p.x - scene.getWidth() / 2); setY(p.y); }
/** * Creates a new instance of {@link JavaFXSplitPanel}. */ public JavaFXSplitPanel() { super(new SplitPane()); resource.setDividerPositions(0.5d); // Containers are necessary as otherwise the SplitPane will misbehave, // for example the divider can't be moved anymore and some such. firstContainer = new FXBorderPane(); secondContainer = new FXBorderPane(); // Also note that the JavaFX SplitPane can contain a not specified number // of items. resource.getItems().add(firstContainer); resource.getItems().add(secondContainer); }
/** * {@inheritDoc} */ @Override public void setDividerAlignment(int pDividerAlignment) { dividerAlignment = pDividerAlignment; SplitPane.setResizableWithParent(firstContainer, Boolean.TRUE); SplitPane.setResizableWithParent(secondContainer, Boolean.TRUE); if (dividerAlignment == DIVIDER_TOP_LEFT) { SplitPane.setResizableWithParent(firstContainer, Boolean.FALSE); } else if (dividerAlignment == DIVIDER_BOTTOM_RIGHT) { SplitPane.setResizableWithParent(secondContainer, Boolean.FALSE); } }
@Override public void start(final Stage stage) { final SplitPane split = new SplitPane(); Label label = new Label("Left"); label.setMaxWidth(Double.MAX_VALUE); label.setStyle(DEBUG_STYLE); final StackPane left = new StackPane(label); label = new Label("Some long text in the right panel"); label.setStyle(DEBUG_STYLE); label.setMaxWidth(Double.MAX_VALUE); label.setPrefWidth(Double.MAX_VALUE); final ScrollPane scroll = new ScrollPane(label); scroll.setHbarPolicy(ScrollBarPolicy.NEVER); scroll.setVbarPolicy(ScrollBarPolicy.ALWAYS); final StackPane right = new StackPane(scroll); split.getItems().addAll(left, right); split.setDividerPositions(0.5); final Scene scene = new Scene(split, 800, 700); stage.setScene(scene); stage.show(); }
private Node layoutContent() { final VBox optionCardLayout = new VBox(5); optionCardLayout.getChildren().addAll(categoryNameLabel, optionsView); optionCardLayout.setPadding(new Insets(0, 5, 0, 15)); final SplitPane mainLayout = new SplitPane(); mainLayout.setOrientation(Orientation.HORIZONTAL); mainLayout.setDividerPosition(0, 0.20); mainLayout.getItems().addAll(optionCategoriesTreeView, optionCardLayout); mainLayout.setPrefSize(770, 500); categoryNameLabel.prefWidthProperty().bind(mainLayout.widthProperty()); SplitPane.setResizableWithParent(optionCategoriesTreeView, Boolean.FALSE); return mainLayout; }
private void showCVDetailLayout(CV cv) { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(CviaApp.class.getResource("/CVDetail.fxml")); SplitPane splitPane = loader.load(); CVDetailController2 cvDetailController = loader.getController(); cvDetailController.populateForm(cv); cvDetailController.setController(null); Scene cvDetailScene = new Scene(splitPane); Stage cvDetailStage = new Stage(); cvDetailStage.setScene(cvDetailScene); cvDetailStage.setResizable(false); cvDetailStage.sizeToScene(); cvDetailStage.show(); cvDetailController.setStage(cvDetailStage); } catch (IOException e) { e.printStackTrace(); } }
@Override public void start(Stage primaryStage) { input = new TextArea(); output = new BorderPane(); SplitPane root = new SplitPane(); root.setDividerPositions(0.5); root.getItems().add(input); root.getItems().add(output); input.textProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { changed = true; } }); Scene scene = new Scene(root, 700, 550); primaryStage.setScene(scene); primaryStage.show(); new Thread(this).start(); }
@Override public void start(Stage stage) throws Exception { SplitPane root = new SplitPane(); final Pane paneFixed = new StackPane(); paneFixed.getChildren().add(new Text("fixed")); SplitPane.setResizableWithParent(paneFixed, Boolean.FALSE); Pane paneFree = new StackPane(); paneFree.getChildren().add(new Text("free")); root.getItems().addAll(paneFree, paneFixed); root.setStyle(".split-pane > .split-pane-divider { -fx-background-insets: 0, 0 1 0 1; } "); stage.setScene(new Scene(root, 300, 200)); stage.show(); }
public void sizeSplitPanes(SplitPane splitpane) { assert splitpane.getScene() != null; assert splitpane.getScene().getWidth() > 0.0d; try { double configuredProcessesWidth = configuredProcessesWidth(); double sceneWidth = splitpane.getScene().getWidth(); double percent = (configuredProcessesWidth / sceneWidth); // the split pane divider position can only be set as a percentage of the split pane splitpane.setDividerPosition(0, percent); splitpane.setDividerPosition(1, 1D - percent); } catch (NumberFormatException e) { e.printStackTrace(); } // whenever the width of the pane changes, write it to configuration // this is buffered so rapid writes do not cause rapid writes to disk entopPane.widthProperty().addListener((o, ov, nv) -> { PrefBind.set("processesWidth", nv); }); }