Rearranges the delimiters of given JavaFX split pane. - Java JavaFX

Java examples for JavaFX:SplitPane

Description

Rearranges the delimiters of given JavaFX split pane.

Demo Code


//package com.java2s;

import javafx.scene.control.SplitPane;

public class Main {
    /**//from w  ww  .j a v  a  2 s .c  o  m
     * Rearranges the delimiters of given split pane.
     *
     * @param splitPane split pane
     */
    public static void rearrangeDividers(SplitPane splitPane) {
        if (!splitPane.getItems().isEmpty()) {
            double[] dividerPositions = splitPane.getDividerPositions();
            for (int i = 0; i < dividerPositions.length; i++) {
                dividerPositions[i] = ((double) i + 1)
                        / (dividerPositions.length + 1);
            }
            splitPane.setDividerPositions(dividerPositions);
        }
    }
}

Related Tutorials