Example usage for javax.swing.plaf.synth SynthSplitPaneUI SynthSplitPaneUI

List of usage examples for javax.swing.plaf.synth SynthSplitPaneUI SynthSplitPaneUI

Introduction

In this page you can find the example usage for javax.swing.plaf.synth SynthSplitPaneUI SynthSplitPaneUI.

Prototype

SynthSplitPaneUI

Source Link

Usage

From source file:com.haulmont.cuba.desktop.gui.components.DesktopSplitPanel.java

public DesktopSplitPanel() {
    impl = new JSplitPane() {
        @Override// w ww  .  ja v a  2  s . co m
        public void paint(Graphics g) {
            super.paint(g);

            if (applyNewPosition) {
                double ratio = position / 100.0;

                impl.setDividerLocation(ratio);
                impl.setResizeWeight(ratio);
                applyNewPosition = false;
            }
        }
    };

    // default orientation as web split
    impl.setOrientation(JSplitPane.VERTICAL_SPLIT);

    impl.setUI(new SynthSplitPaneUI() {
        @Override
        protected void dragDividerTo(int location) {
            super.dragDividerTo(location);

            // user touched split divider
            positionChanged = true;
        }
    });

    impl.setLeftComponent(new JPanel());
    impl.setRightComponent(new JPanel());

    impl.getLeftComponent().setMinimumSize(new Dimension());
    impl.getRightComponent().setMinimumSize(new Dimension());
}