Java JSplitPane hsplit(Component left, Component right, double resizeWeight)

Here you can find the source of hsplit(Component left, Component right, double resizeWeight)

Description

Create a horizontally aligned JSplitPane

License

Open Source License

Parameter

Parameter Description
left The left component
right The right component
resizeWeight How much resize weight to use

Return

The split pane

Declaration

public static JSplitPane hsplit(Component left, Component right, double resizeWeight) 

Method Source Code

//package com.java2s;
/*/*  ww w.  j  av a  2 s. c o m*/
 * Copyright 1997-2016 Unidata Program Center/University Corporation for
 * Atmospheric Research, P.O. Box 3000, Boulder, CO 80307,
 * support@unidata.ucar.edu.
 * 
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

import java.awt.Component;

import javax.swing.JSplitPane;

public class Main {
    /**
     *  Create a horizontally aligned JSplitPane. Give the left component the specified
     *  space.
     *
     * @param left The left component
     * @param right The right component
     * @param leftSpace Where to put the divider
     * @param resizeWeight The resize weight
     * @return The split pane
     *
     */
    public static JSplitPane hsplit(Component left, Component right, int leftSpace, double resizeWeight) {
        JSplitPane split = hsplit(left, right, leftSpace);
        split.setResizeWeight(resizeWeight);
        return split;
    }

    /**
     *  Create a  horizontally aligned JSplitPane
     *
     * @param left The left component
     * @param right The right component
     * @param leftSpace Where to put the divider
     * @return The split pane
     */
    public static JSplitPane hsplit(Component left, Component right, int leftSpace) {
        JSplitPane split = hsplit(left, right);
        if (leftSpace >= 0) {
            split.setDividerLocation(leftSpace);
        }
        return split;
    }

    /**
     *  Create a  horizontally aligned JSplitPane
     *
     * @param left The left component
     * @param right The right component
     * @param resizeWeight How much resize weight  to use
     * @return The split pane
     */
    public static JSplitPane hsplit(Component left, Component right, double resizeWeight) {
        JSplitPane split = hsplit(left, right);
        split.setResizeWeight(resizeWeight);
        return split;
    }

    /**
     *  Create a basic horizontally aligned JSplitPane
     *
     * @param left The left component
     * @param right The right component
     * @return The split pane
     */
    public static JSplitPane hsplit(Component left, Component right) {
        return new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
    }
}

Related

  1. flattenJSplitPane(JSplitPane splitPane)
  2. getPref(JSplitPane jSplitPane)
  3. getSplitPane(boolean vertical, JComponent left, JComponent right)
  4. getSplitPaneComponentLength(JSplitPane splitPane, Component component)
  5. getSplitPaneSize(JSplitPane splitPane)
  6. rememberOldHeightRatio (JSplitPane splitPane)
  7. sanitizeSplitPaneDivider(JSplitPane splitPane)
  8. setDividerLocation(final JSplitPane splitter, final int position)
  9. setNewHeightRatio (JSplitPane splitPane, JComponent comp, float oldFraction, int v1, int v2)