Java Code Examples for javafx.scene.control.SplitPane#setDividerPositions()

The following examples show how to use javafx.scene.control.SplitPane#setDividerPositions() . 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: HiddenSplitPaneApp.java    From mdict-java with GNU General Public License v3.0 6 votes vote down vote up
public Parent createContent() {
    Region region1 = new Region();
    Region region2 = new Region();
    region1.getStyleClass().add("rounded");
    //region2.getStyleClass().add("rounded");

    final SplitPane splitPane = new SplitPane();
    final String hidingSplitPaneCss =
        getClass().getResource("HiddenSplitPane.css").toExternalForm();
    splitPane.setId("hiddenSplitter");
    splitPane.getItems().addAll(region1, region2);
    splitPane.setDividerPositions(0.33, 0.66);
    splitPane.getStylesheets().add(hidingSplitPaneCss);

    return splitPane;
}
 
Example 2
Source File: AttachPane.java    From Recaf with MIT License 6 votes vote down vote up
/**
 * Setup primary components.
 */
private void setup() {
	view.getStyleClass().add("vm-view");
	list.getStyleClass().add("vm-list");
	list.setItems(FXCollections.observableArrayList());
	list.setCellFactory(c -> new VMCell());
	list.getSelectionModel().selectedItemProperty().addListener((ob, o, n) -> {
		view.setCenter(createVmDisplay(n));
	});
	SplitPane split = new SplitPane(list, view);
	SplitPane.setResizableWithParent(list, Boolean.FALSE);
	split.setDividerPositions(0.37);
	setCenter(split);
	// Create thread to continually update vm info (remove dead vms, add new ones)
	ThreadUtil.runRepeated(UPDATE_TIME_MS, () -> {
		Stage attachWindow = controller.windows().getAttachWindow();
		if (attachWindow == null || attachWindow.isShowing()) {
			refreshVmList();
		}
	});
}
 
Example 3
Source File: MainWindow.java    From milkman with MIT License 5 votes vote down vote up
public MainWindowFxml(MainWindow controller) {
	controller.root = this;
	this.setId("root");
	BorderPane borderpane = new BorderPane();
	borderpane.setTop(new ToolbarComponentFxml(controller.toolbarComponent));
	this.getChildren().add(borderpane);
	
	SplitPane splitPane = new SplitPane();
	splitPane.setDividerPositions(0.2);
	
	splitPane.getItems().add(new RequestCollectionComponentFxml(controller.requestCollectionComponent));
	splitPane.getItems().add(new WorkingAreaComponentFxml(controller.workingArea));
	borderpane.setCenter(splitPane);
}
 
Example 4
Source File: JavaFXSplitPaneElement.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean marathon_select(String value) {
    SplitPane splitPane = (SplitPane) getComponent();
    JSONArray locations = new JSONArray(value);
    double[] dividerLocations = new double[locations.length()];
    for (int i = 0; i < locations.length(); i++) {
        dividerLocations[i] = locations.getDouble(i);
    }
    splitPane.setDividerPositions(dividerLocations);
    return true;
}
 
Example 5
Source File: SplitPaneSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public SplitPaneSample() {
    SplitPane sp = new SplitPane();
    sp.setPrefSize(250, 250);

    StackPane sp1 = new StackPane();
    sp1.getChildren().add(new Button("Button One"));
    final StackPane sp2 = new StackPane();
    sp2.getChildren().add(new Button("Button Two"));
    final StackPane sp3 = new StackPane();
    sp3.getChildren().add(new Button("Button Three"));
    sp.getItems().addAll(sp1, sp2, sp3);
    sp.setDividerPositions(0.3f, 0.6f, 0.9f);
    getChildren().add(sp);
}
 
Example 6
Source File: OrsonChartsFXDemo.java    From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
   
    TabPane tabPane = new TabPane();
    Tab tab1 = new Tab();
    tab1.setText("Demos");
    tab1.setClosable(false);
    
    SplitPane sp = new SplitPane();
    final StackPane sp1 = new StackPane();
    sp1.getChildren().add(createTreeView());
    final BorderPane sp2 = new BorderPane();
    sp2.setCenter(createChartPane());
 
    sp.getItems().addAll(sp1, sp2);
    sp.setDividerPositions(0.3f, 0.6f);
    tab1.setContent(sp);
    tabPane.getTabs().add(tab1);        
 
    Tab tab2 = new Tab();
    tab2.setText("About");
    tab2.setClosable(false);
    
    WebView browser = new WebView();
    WebEngine webEngine = browser.getEngine();
    webEngine.load(getClass().getResource("/org/jfree/chart3d/fx/demo/about.html").toString());
    tab2.setContent(browser);
    tabPane.getTabs().add(tab2);        

    Scene scene = new Scene(tabPane, 1024, 768);
    stage.setScene(scene);
    stage.setTitle("Orson Charts JavaFX Demo");
    stage.show();
}
 
Example 7
Source File: MainWindow.java    From Recaf with MIT License 5 votes vote down vote up
private void setup() {
	stage.getIcons().add(new Image(resource("icons/logo.png")));
	stage.setTitle("Recaf");
	menubar = new MainMenu(controller);
	root = new BorderPane();
	root.setTop(menubar);
	navRoot = new BorderPane();
	viewRoot = new BorderPane();
	tabs = new ViewportTabs(controller);
	SplitPane split = new SplitPane();
	split.setOrientation(Orientation.HORIZONTAL);
	split.getItems().addAll(navRoot, viewRoot);
	split.setDividerPositions(0.333);
	SplitPane.setResizableWithParent(navRoot, Boolean.FALSE);
	root.setCenter(split);
	viewRoot.setCenter(tabs);
	// Navigation
	updateWorkspaceNavigator();
	Recaf.getWorkspaceSetListeners().add(w -> updateWorkspaceNavigator());
	// Create scene & display the window
	Scene scene = new Scene(root, 800, 600);
	controller.windows().reapplyStyle(scene);
	controller.config().keys().registerMainWindowKeys(controller, stage, scene);
	stage.setScene(scene);
	// Show update prompt
	if (SelfUpdater.hasUpdate())
		UpdateWindow.create(this).show(root);
}
 
Example 8
Source File: HistoryPane.java    From Recaf with MIT License 5 votes vote down vote up
private void setup() {
	list.setCellFactory(cb -> new HistCell());
	list.getSelectionModel().selectedItemProperty().addListener((ob, o, n) -> {
		view.setCenter(createHistoryView(n == null ? o : n));
	});
	view.getStyleClass().add("hist-view");
	SplitPane split = new SplitPane(list, view);
	SplitPane.setResizableWithParent(list, Boolean.FALSE);
	split.setDividerPositions(0.37);
	setCenter(split);
}
 
Example 9
Source File: PluginManagerPane.java    From Recaf with MIT License 5 votes vote down vote up
private void setup() {
	list.setCellFactory(cb -> new PluginCell());
	list.getSelectionModel().selectedItemProperty().addListener((ob, o, n) -> {
		view.setCenter(createPluginView(n == null ? o : n));
	});
	list.setItems(FXCollections.observableArrayList(PluginsManager.getInstance().plugins().values()));
	view.getStyleClass().add("plugin-view");
	SplitPane split = new SplitPane(list, view);
	SplitPane.setResizableWithParent(list, Boolean.FALSE);
	split.setDividerPositions(0.37);
	setCenter(split);
}
 
Example 10
Source File: FxWindow.java    From JRemapper with MIT License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
	SplitPane split = new SplitPane(new FilePane(), new ContentPane());
	split.setDividerPositions(0.2);
	Scene scene = new Scene(split, 900, 600);
	scene.getStylesheets().add("resources/style/style.css");
	setupBinds(stage, scene);
	stage.setScene(scene);
	stage.setTitle("JRemapper");
	stage.show();
}
 
Example 11
Source File: ParsedViewerPane.java    From classpy with MIT License 5 votes vote down vote up
private SplitPane buildSplitPane() {
    SplitPane sp = new SplitPane();
    sp.getItems().add(tree);
    sp.getItems().add(hexPane);
    sp.setDividerPositions(0.3, 0.7);
    return sp;
}
 
Example 12
Source File: MainLayout.java    From redtorch with MIT License 4 votes vote down vote up
private void createLayout() {

		vBox.getChildren().add(crearteMainMenuBar());
		// 左右切分布局------------------------
		SplitPane horizontalSplitPane = new SplitPane();
		horizontalSplitPane.setDividerPositions(0.5);
		vBox.getChildren().add(horizontalSplitPane);
		VBox.setVgrow(horizontalSplitPane, Priority.ALWAYS);

		// 左右切分布局----左侧上下切分布局---------
		SplitPane leftVerticalSplitPane = new SplitPane();
		leftVerticalSplitPane.setDividerPositions(0.4);
		horizontalSplitPane.getItems().add(leftVerticalSplitPane);
		leftVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		// 左右切分布局----左侧上下切分布局----上布局-----
		SplitPane leftTopHorizontalSplitPane = new SplitPane();
		leftVerticalSplitPane.getItems().add(leftTopHorizontalSplitPane);

		HBox leftTopRithtPane = new HBox();
		Node orderPanelLayoutNode = orderPanelLayout.getNode();
		HBox.setHgrow(orderPanelLayoutNode, Priority.ALWAYS);

		ScrollPane marketDetailsScrollPane = new ScrollPane();
		Node marketDetailsNode = marketDetailsLayout.getNode();
		marketDetailsScrollPane.setContent(marketDetailsNode);
		marketDetailsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
		marketDetailsScrollPane.setPrefWidth(253);
		marketDetailsScrollPane.setMinWidth(253);
		marketDetailsScrollPane.setMaxWidth(253);
		leftTopRithtPane.getChildren().addAll(marketDetailsScrollPane, orderPanelLayoutNode);
		leftTopRithtPane.setMaxWidth(680);
		leftTopRithtPane.setPrefWidth(680);

		leftTopHorizontalSplitPane.getItems().addAll(tickLayout.getNode(), leftTopRithtPane);
		SplitPane.setResizableWithParent(leftTopRithtPane, false);

		// 左右切分布局----左侧上下切分布局----下布局-----
		TabPane leftBootomTabPane = new TabPane();
		leftVerticalSplitPane.getItems().add(leftBootomTabPane);

		Tab orderTab = new Tab("定单");
		leftBootomTabPane.getTabs().add(orderTab);
		orderTab.setClosable(false);

		orderTab.setContent(orderLayout.getNode());

		Tab tradeTab = new Tab("成交");
		leftBootomTabPane.getTabs().add(tradeTab);
		tradeTab.setClosable(false);

		tradeTab.setContent(tradeLayout.getNode());

		// 左右切分布局----右侧TAB布局-------------
		TabPane rightTabPane = new TabPane();
		horizontalSplitPane.getItems().add(rightTabPane);

		Tab portfolioInvestmentTab = new Tab("投资组合");
		rightTabPane.getTabs().add(portfolioInvestmentTab);
		portfolioInvestmentTab.setClosable(false);

		SplitPane portfolioVerticalSplitPane = new SplitPane();
		portfolioInvestmentTab.setContent(portfolioVerticalSplitPane);
		portfolioVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		VBox.setVgrow(portfolioVerticalSplitPane, Priority.ALWAYS);

		VBox portfolioVBox = new VBox();
		portfolioVBox.getChildren().add(combinationLayout.getNode());

		portfolioVBox.getChildren().add(accountLayout.getNode());

		VBox.setVgrow(accountLayout.getNode(), Priority.ALWAYS);

		portfolioVerticalSplitPane.getItems().add(portfolioVBox);

		portfolioVerticalSplitPane.getItems().add(positionLayout.getNode());

		Tab allContractTab = new Tab("全部合约");
		allContractTab.setContent(contractLayout.getNode());
		rightTabPane.getTabs().add(allContractTab);
		allContractTab.setClosable(false);

		// 状态栏------------------------------
		vBox.getChildren().add(createStatusBar());
	}
 
Example 13
Source File: ImageList.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
private Node createImageSection()
{
    preview.setPreserveRatio(true);
    preview.setManaged(false);

    final Button removeImage   = new Button(Messages.Remove, ImageCache.getImageView(ImageCache.class, "/icons/delete.png"));
    removeImage.setTooltip(new Tooltip(Messages.RemoveImage));
    removeImage.setOnAction(event ->
    {
        final Image image = preview.getImage();
        if (image != null)
        {
            images.getItems().remove(image);
            selectFirstImage();
        }
    });

    final StackPane left = new StackPane(preview, removeImage);
    // Image in background fills the area
    preview.setX(5);
    preview.setY(5);
    preview.fitWidthProperty().bind(left.widthProperty());
    preview.fitHeightProperty().bind(left.heightProperty());
    // Remove button on top, upper right corner
    StackPane.setAlignment(removeImage, Pos.TOP_RIGHT);
    StackPane.setMargin(removeImage, new Insets(5));

    images.setPlaceholder(new Label(Messages.NoImages));
    images.setStyle("-fx-control-inner-background-alt: #f4f4f4");
    images.setStyle("-fx-control-inner-background: #f4f4f4");
    images.setCellFactory(param -> new ImageCell(preview));

    // Show selected image in preview
    preview.imageProperty().bind(images.getSelectionModel().selectedItemProperty());
    // Enable button if something is selected
    removeImage.disableProperty().bind(Bindings.isEmpty(images.getSelectionModel().getSelectedItems()));

    VBox.setVgrow(images, Priority.ALWAYS);
    final VBox right = new VBox(new Label(Messages.ImagesTitle), images);
    right.setPadding(new Insets(5));

    final SplitPane split = new SplitPane(left, right);
    split.setDividerPositions(0.7);
    return split;
}