Example usage for javax.swing JSplitPane getSize

List of usage examples for javax.swing JSplitPane getSize

Introduction

In this page you can find the example usage for javax.swing JSplitPane getSize.

Prototype

public Dimension getSize() 

Source Link

Document

Returns the size of this component in the form of a Dimension object.

Usage

From source file:org.ngrinder.recorder.Recorder.java

/**
 * Create a split pane with the give left and right components.
 * /*  w w w.j  a va  2s. c  o m*/
 * @param left
 *            component located in left
 * @param right
 *            component located in right
 * @return JSplitPane instance
 */
protected JSplitPane createSplitPane(final JComponent left, final JComponent right) {
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, left, right);
    splitPane.setDividerLocation(
            splitPane.getSize().width - splitPane.getInsets().right - splitPane.getDividerSize() - 200);
    splitPane.setResizeWeight(1);
    splitPane.setMinimumSize(new Dimension(600, 600));
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerSize(10);
    return splitPane;
}

From source file:tpp.TPPFrame.java

/** Set the model that this window is used to visualise */
void setData(Instances in) {
    try {//from   w  w  w  . ja v  a 2 s. c  om
        model = new ScatterPlotModel(2);
        model.setInstances(in);
        viewPanel = new ScatterPlotViewPanel();
        controlPanel = new ScatterPlotControlPanel();
        controlPanel.setModel(model);
        viewPanel.setModel(model);
        ScatterPlotViewPanelMouseListener l = new ScatterPlotViewPanelMouseListener(viewPanel, model);
        viewPanel.addMouseListener(l);
        viewPanel.addMouseMotionListener(l);
        setTitle(model.getInstances().relationName());
        enableViewMenuItems();
        JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, viewPanel, controlPanel);
        split.setResizeWeight(0.8);
        setContentPane(split);
        setVisible(true);
        split.setDividerLocation(split.getSize().width - 250);
        Dimension minimumSize = new Dimension(0, 0);
        viewPanel.setMinimumSize(minimumSize);
        controlPanel.setMinimumSize(minimumSize);
        viewPanel.repaint();
    } catch (Exception e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(this, "There was a problem reading that data: " + e.getMessage());
    }
}