Example usage for javax.swing JSplitPane setResizeWeight

List of usage examples for javax.swing JSplitPane setResizeWeight

Introduction

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

Prototype

@BeanProperty(description = "Specifies how to distribute extra space when the split pane resizes.")
public void setResizeWeight(double value) 

Source Link

Document

Specifies how to distribute extra space when the size of the split pane changes.

Usage

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    JFrame frame = new JFrame("Property Split");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setResizeWeight(1.0);
    splitPane.setTopComponent(new JLabel("www.java2s.com"));

    splitPane.setBottomComponent(new JLabel("www.java2s.com"));

    frame.add(splitPane, BorderLayout.CENTER);
    frame.setSize(300, 150);//from   w ww .  j  av  a2 s  . com
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JButton leftComponent = new JButton("left");
    JButton rightComponent = new JButton("right");
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);
    double weight = pane.getResizeWeight(); // 0.0 by default

    weight = 1D;//from ww w  .j a  v  a2 s .c  om
    pane.setResizeWeight(weight);

    weight = .5D;
    pane.setResizeWeight(weight);
}

From source file:ResizeSplit.java

public static void main(String args[]) {
    String title = "Resize Split";

    final JFrame vFrame = new JFrame(title);
    vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JButton topButton = new JButton("Top");
    JButton bottomButton = new JButton("Bottom");
    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(topButton);
    splitPane.setBottomComponent(bottomButton);
    ActionListener oneActionListener = new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            splitPane.setResizeWeight(1.0);
            vFrame.setSize(300, 250);//from   w  ww. j a  v a2  s  .c om
            vFrame.validate();
        }
    };
    bottomButton.addActionListener(oneActionListener);

    ActionListener anotherActionListener = new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            splitPane.setResizeWeight(0.5);
            vFrame.setSize(300, 250);
            vFrame.validate();
        }
    };
    topButton.addActionListener(anotherActionListener);
    vFrame.getContentPane().add(splitPane, BorderLayout.CENTER);
    vFrame.setSize(300, 150);
    vFrame.setVisible(true);

}

From source file:com.intuit.tank.tools.debugger.PanelBuilder.java

static Component createRightPanel(final AgentDebuggerFrame frame) {
    JPanel ret = new JPanel(new BorderLayout());
    ret.add(BorderLayout.NORTH, new InfoHeaderPanel(frame));
    JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
    pane.setTopComponent(new VariablesPanel(frame));
    pane.setBottomComponent(frame.getRequestResponsePanel());
    pane.setDividerLocation(250);/*ww  w . jav  a2s  .c  o  m*/
    pane.setResizeWeight(0.25D);
    ret.add(BorderLayout.CENTER, pane);
    return ret;
}

From source file:hu.bme.mit.sette.snippetbrowser.SnippetBrowser.java

/**
 * Initialise the contents of the frame.
 *//*from w w w .  java  2  s  .c o m*/
private void initialize() {
    setTitle("Snippet Browser");
    this.setBounds(50, 50, 1000, 600);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setResizeWeight(0.3);
    getContentPane().add(splitPane, BorderLayout.CENTER);

    JScrollPane scrollPaneLeft = new JScrollPane();
    splitPane.setLeftComponent(scrollPaneLeft);

    treeSnippets = new JTree();
    scrollPaneLeft.setViewportView(treeSnippets);

    JScrollPane scrollPaneRight = new JScrollPane();
    splitPane.setRightComponent(scrollPaneRight);

    txtrInfo = new JTextArea();
    txtrInfo.setEditable(false);
    scrollPaneRight.setViewportView(txtrInfo);
}

From source file:com.choicemaker.cm.modelmaker.gui.panels.AsymmetricThresholdVsAccuracyPlotPanel.java

private void layoutPanel() {
    setLayout(new BorderLayout());
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setDividerSize(2);//from  w ww.j a  v  a  2s  .  c om
    splitPane.setContinuousLayout(true);
    splitPane.setDividerLocation(0.5d);
    splitPane.setResizeWeight(0.5f);
    splitPane.setOneTouchExpandable(true);
    ChartPanel dP = new ChartPanel(dPlot, false, false, false, true, true);
    //      dP.setHorizontalZoom(true);
    //      dP.setVerticalZoom(true);
    splitPane.setTopComponent(dP);
    ChartPanel mP = new ChartPanel(mPlot, false, false, false, true, true);
    //      mP.setHorizontalZoom(true);
    //      mP.setVerticalZoom(true);
    splitPane.setBottomComponent(mP);
    add(splitPane, BorderLayout.CENTER);
}

From source file:ec.ui.view.res.ResidualsView.java

public ResidualsView() {
    this.chartPanel = new ChartPanel(buildResidualViewChart());
    Charts.avoidScaling(chartPanel);// ww  w . j  a  v a2s .c o  m
    this.grid = new JTsGrid();
    this.grid.setTsUpdateMode(TsUpdateMode.None);
    this.grid.setMode(Mode.SINGLETS);

    onDataFormatChange();
    onColorSchemeChange();
    onComponentPopupMenuChange();

    enableProperties();

    JSplitPane splitPane = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, chartPanel, grid);
    splitPane.setDividerLocation(0.5);
    splitPane.setResizeWeight(.5);
    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);
}

From source file:fi.smaa.jsmaa.gui.JSMAAMainFrame.java

private void rebuildGUI() {
    JSplitPane splitPane = new JSplitPane();
    splitPane.setResizeWeight(0.1);
    splitPane.setDividerSize(2);//from w w  w  .  jav  a 2 s.c o  m
    splitPane.setDividerLocation(-1);

    rightPane = new JScrollPane();
    rightPane.getVerticalScrollBar().setUnitIncrement(16);
    splitPane.setRightComponent(rightPane);

    JScrollPane leftScrollPane = new JScrollPane();
    leftScrollPane.setViewportView(guiFactory.getTree());
    splitPane.setLeftComponent(leftScrollPane);

    getContentPane().removeAll();
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add("Center", splitPane);
    getContentPane().add("North", guiFactory.getTopToolBar());
    getContentPane().add("South", guiFactory.getBottomToolBar());
    setJMenuBar(guiFactory.getMenuBar());

    guiFactory.getTree().addTreeSelectionListener(new LeftTreeSelectionListener());
    pack();
}

From source file:com.sri.ai.praise.demo.ChurchPanel.java

private void initialize() {
    setLayout(new BorderLayout(0, 0));

    JPanel rootPanel = new JPanel();
    add(rootPanel, BorderLayout.CENTER);
    rootPanel.setLayout(new BorderLayout(0, 0));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setContinuousLayout(true);
    splitPane.setResizeWeight(0.5);
    splitPane.setOneTouchExpandable(true);
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    rootPanel.add(splitPane, BorderLayout.CENTER);

    JPanel churchPanel = new JPanel();
    churchPanel.setLayout(new BorderLayout(0, 0));

    JLabel lblNewLabel = new JLabel("Church Program");
    churchPanel.add(lblNewLabel, BorderLayout.NORTH);

    churchEditor = new ChurchEditor();
    churchPanel.add(churchEditor, BorderLayout.CENTER);

    splitPane.setLeftComponent(churchPanel);

    JPanel hogmPanel = new JPanel();
    hogmPanel.setLayout(new BorderLayout(0, 0));

    JLabel lblNewLabel_1 = new JLabel("Generated Model (Read Only)");
    hogmPanel.add(lblNewLabel_1, BorderLayout.NORTH);

    hogmEditor = new RuleEditor();
    hogmEditor.setEditable(false);//  w  w w .  j  a  v a2  s.c  om
    hogmPanel.add(hogmEditor, BorderLayout.CENTER);

    splitPane.setRightComponent(hogmPanel);
}

From source file:org.moeaframework.examples.gp.regression.SymbolicRegressionGUI.java

/**
 * Layout the components on the GUI.//from  w w  w  .j  a  va2s  . c om
 */
protected void layoutComponents() {
    container.setMinimumSize(new Dimension(300, 300));

    JScrollPane detailsPane = new JScrollPane(details);
    detailsPane.setMinimumSize(new Dimension(150, 150));

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, container, detailsPane);
    splitPane.setResizeWeight(0.5);
    splitPane.setDividerLocation(0.4);

    JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.CENTER));
    buttonPane.add(close);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(splitPane, BorderLayout.CENTER);
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
}