jdk/src/share/classes/javax/swing/JSplitPane.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 438 2ae294e4518c
child 2658 43e06bc950ec
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 438
diff changeset
     2
 * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
package javax.swing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.beans.ConstructorProperties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.accessibility.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.io.ObjectOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.io.ObjectInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <code>JSplitPane</code> is used to divide two (and only two)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <code>Component</code>s. The two <code>Component</code>s
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * are graphically divided based on the look and feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * implementation, and the two <code>Component</code>s can then be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * interactively resized by the user.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * Information on using <code>JSplitPane</code> is in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 href="http://java.sun.com/docs/books/tutorial/uiswing/components/splitpane.html">How to Use Split Panes</a> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <em>The Java Tutorial</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * The two <code>Component</code>s in a split pane can be aligned
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * left to right using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <code>JSplitPane.HORIZONTAL_SPLIT</code>, or top to bottom using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <code>JSplitPane.VERTICAL_SPLIT</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * The preferred way to change the size of the <code>Component</code>s
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * is to invoke
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <code>setDividerLocation</code> where <code>location</code> is either
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * the new x or y position, depending on the orientation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <code>JSplitPane</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * To resize the <code>Component</code>s to their preferred sizes invoke
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * <code>resetToPreferredSizes</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * When the user is resizing the <code>Component</code>s the minimum
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * size of the <code>Components</code> is used to determine the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * maximum/minimum position the <code>Component</code>s
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * can be set to. If the minimum size of the two
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * components is greater than the size of the split pane the divider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * will not allow you to resize it. To alter the minimum size of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * <code>JComponent</code>, see {@link JComponent#setMinimumSize}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * When the user resizes the split pane the new space is distributed between
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * the two components based on the <code>resizeWeight</code> property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * A value of 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * the default, indicates the right/bottom component gets all the space,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * where as a value of 1 indicates the left/top component gets all the space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * <strong>Warning:</strong> Swing is not thread safe. For more
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * information see <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * href="package-summary.html#threading">Swing's Threading
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * Policy</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * the same version of Swing.  As of 1.4, support for long term storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * of all JavaBeans<sup><font size="-2">TM</font></sup>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * @see #setDividerLocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * @see #resetToPreferredSizes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * @author Scott Violet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
public class JSplitPane extends JComponent implements Accessible
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @see #getUIClassID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @see #readObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    private static final String uiClassID = "SplitPaneUI";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Vertical split indicates the <code>Component</code>s are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * split along the y axis.  For example the two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * <code>Component</code>s will be split one on top of the other.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    public final static int VERTICAL_SPLIT = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * Horizontal split indicates the <code>Component</code>s are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * split along the x axis.  For example the two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * <code>Component</code>s will be split one to the left of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * other.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    public final static int HORIZONTAL_SPLIT = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Used to add a <code>Component</code> to the left of the other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    public final static String LEFT = "left";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * Used to add a <code>Component</code> to the right of the other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public final static String RIGHT = "right";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * Used to add a <code>Component</code> above the other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public final static String TOP = "top";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * Used to add a <code>Component</code> below the other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    public final static String BOTTOM = "bottom";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * Used to add a <code>Component</code> that will represent the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public final static String DIVIDER = "divider";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Bound property name for orientation (horizontal or vertical).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    public final static String ORIENTATION_PROPERTY = "orientation";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * Bound property name for continuousLayout.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public final static String CONTINUOUS_LAYOUT_PROPERTY = "continuousLayout";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * Bound property name for border.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    public final static String DIVIDER_SIZE_PROPERTY = "dividerSize";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * Bound property for oneTouchExpandable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public final static String ONE_TOUCH_EXPANDABLE_PROPERTY =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                               "oneTouchExpandable";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Bound property for lastLocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    public final static String LAST_DIVIDER_LOCATION_PROPERTY =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                               "lastDividerLocation";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * Bound property for the dividerLocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public final static String DIVIDER_LOCATION_PROPERTY = "dividerLocation";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * Bound property for weight.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    public final static String RESIZE_WEIGHT_PROPERTY = "resizeWeight";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * How the views are split.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    protected int orientation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * Whether or not the views are continuously redisplayed while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * resizing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    protected boolean continuousLayout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * The left or top component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    protected Component leftComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * The right or bottom component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    protected Component rightComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * Size of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    protected int dividerSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    private boolean dividerSizeSet = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * Is a little widget provided to quickly expand/collapse the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * split pane?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    protected boolean oneTouchExpandable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    private boolean oneTouchExpandableSet;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * Previous location of the split pane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    protected int lastDividerLocation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * How to distribute extra space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    private double resizeWeight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Location of the divider, at least the value that was set, the UI may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * have a different value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    private int dividerLocation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * Creates a new <code>JSplitPane</code> configured to arrange the child
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * components side-by-side horizontally with no continuous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * layout, using two buttons for the components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    public JSplitPane() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        this(JSplitPane.HORIZONTAL_SPLIT, false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            new JButton(UIManager.getString("SplitPane.leftButtonText")),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            new JButton(UIManager.getString("SplitPane.rightButtonText")));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * Creates a new <code>JSplitPane</code> configured with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * specified orientation and no continuous layout.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * @param newOrientation  <code>JSplitPane.HORIZONTAL_SPLIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *                        <code>JSplitPane.VERTICAL_SPLIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @exception IllegalArgumentException if <code>orientation</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *          is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    @ConstructorProperties({"orientation"})
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    public JSplitPane(int newOrientation) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        this(newOrientation, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * Creates a new <code>JSplitPane</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * orientation and redrawing style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * @param newOrientation  <code>JSplitPane.HORIZONTAL_SPLIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     *                        <code>JSplitPane.VERTICAL_SPLIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @param newContinuousLayout  a boolean, true for the components to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     *        redraw continuously as the divider changes position, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     *        to wait until the divider position stops changing to redraw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * @exception IllegalArgumentException if <code>orientation</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     *          is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    public JSplitPane(int newOrientation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                      boolean newContinuousLayout) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        this(newOrientation, newContinuousLayout, null, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * Creates a new <code>JSplitPane</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * orientation and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * with the specified components that do not do continuous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * redrawing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @param newOrientation  <code>JSplitPane.HORIZONTAL_SPLIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     *                        <code>JSplitPane.VERTICAL_SPLIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @param newLeftComponent the <code>Component</code> that will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     *          appear on the left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     *          of a horizontally-split pane, or at the top of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *          vertically-split pane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * @param newRightComponent the <code>Component</code> that will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *          appear on the right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *          of a horizontally-split pane, or at the bottom of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     *          vertically-split pane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @exception IllegalArgumentException if <code>orientation</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *          is not one of: HORIZONTAL_SPLIT or VERTICAL_SPLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    public JSplitPane(int newOrientation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                      Component newLeftComponent,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                      Component newRightComponent){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        this(newOrientation, false, newLeftComponent, newRightComponent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * Creates a new <code>JSplitPane</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * orientation and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * redrawing style, and with the specified components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @param newOrientation  <code>JSplitPane.HORIZONTAL_SPLIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     *                        <code>JSplitPane.VERTICAL_SPLIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @param newContinuousLayout  a boolean, true for the components to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     *        redraw continuously as the divider changes position, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *        to wait until the divider position stops changing to redraw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @param newLeftComponent the <code>Component</code> that will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     *          appear on the left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     *          of a horizontally-split pane, or at the top of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     *          vertically-split pane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * @param newRightComponent the <code>Component</code> that will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *          appear on the right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     *          of a horizontally-split pane, or at the bottom of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     *          vertically-split pane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * @exception IllegalArgumentException if <code>orientation</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     *          is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    public JSplitPane(int newOrientation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                      boolean newContinuousLayout,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                      Component newLeftComponent,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                      Component newRightComponent){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        dividerLocation = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        setLayout(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        setUIProperty("opaque", Boolean.TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        orientation = newOrientation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        if (orientation != HORIZONTAL_SPLIT && orientation != VERTICAL_SPLIT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            throw new IllegalArgumentException("cannot create JSplitPane, " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                                               "orientation must be one of " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                                               "JSplitPane.HORIZONTAL_SPLIT " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                                               "or JSplitPane.VERTICAL_SPLIT");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        continuousLayout = newContinuousLayout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        if (newLeftComponent != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
            setLeftComponent(newLeftComponent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        if (newRightComponent != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            setRightComponent(newRightComponent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        updateUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * Sets the L&F object that renders this component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @param ui  the <code>SplitPaneUI</code> L&F object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @see UIDefaults#getUI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     *       hidden: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *    attribute: visualUpdate true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     *  description: The UI object that implements the Component's LookAndFeel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    public void setUI(SplitPaneUI ui) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        if ((SplitPaneUI)this.ui != ui) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            super.setUI(ui);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            revalidate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * Returns the <code>SplitPaneUI</code> that is providing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * current look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * @return the <code>SplitPaneUI</code> object that renders this component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     *       expert: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *  description: The L&F object that renders this component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    public SplitPaneUI getUI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        return (SplitPaneUI)ui;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * Notification from the <code>UIManager</code> that the L&F has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * Replaces the current UI object with the latest version from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * <code>UIManager</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * @see JComponent#updateUI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    public void updateUI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        setUI((SplitPaneUI)UIManager.getUI(this));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        revalidate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * Returns the name of the L&F class that renders this component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @return the string "SplitPaneUI"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * @see JComponent#getUIClassID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * @see UIDefaults#getUI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     *       expert: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     *  description: A string that specifies the name of the L&F class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    public String getUIClassID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        return uiClassID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * Sets the size of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * @param newSize an integer giving the size of the divider in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     *  description: The size of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    public void setDividerSize(int newSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        int           oldSize = dividerSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        dividerSizeSet = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        if (oldSize != newSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            dividerSize = newSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            firePropertyChange(DIVIDER_SIZE_PROPERTY, oldSize, newSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * Returns the size of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * @return an integer giving the size of the divider in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    public int getDividerSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        return dividerSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * Sets the component to the left (or above) the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * @param comp the <code>Component</code> to display in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    public void setLeftComponent(Component comp) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        if (comp == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            if (leftComponent != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                remove(leftComponent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                leftComponent = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
            add(comp, JSplitPane.LEFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * Returns the component to the left (or above) the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * @return the <code>Component</code> displayed in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     *    preferred: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     *  description: The component to the left (or above) the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    public Component getLeftComponent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        return leftComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * Sets the component above, or to the left of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     * @param comp the <code>Component</code> to display in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     *  description: The component above, or to the left of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    public void setTopComponent(Component comp) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        setLeftComponent(comp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * Returns the component above, or to the left of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * @return the <code>Component</code> displayed in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    public Component getTopComponent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        return leftComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     * Sets the component to the right (or below) the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * @param comp the <code>Component</code> to display in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     *    preferred: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     *  description: The component to the right (or below) the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    public void setRightComponent(Component comp) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        if (comp == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
            if (rightComponent != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
                remove(rightComponent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
                rightComponent = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            add(comp, JSplitPane.RIGHT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * Returns the component to the right (or below) the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     * @return the <code>Component</code> displayed in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    public Component getRightComponent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
        return rightComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     * Sets the component below, or to the right of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * @param comp the <code>Component</code> to display in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     *  description: The component below, or to the right of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    public void setBottomComponent(Component comp) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        setRightComponent(comp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * Returns the component below, or to the right of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * @return the <code>Component</code> displayed in that position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    public Component getBottomComponent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        return rightComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     * Sets the value of the <code>oneTouchExpandable</code> property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * which must be <code>true</code> for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * <code>JSplitPane</code> to provide a UI widget
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * on the divider to quickly expand/collapse the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * The default value of this property is <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     * Some look and feels might not support one-touch expanding;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * they will ignore this property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * @param newValue <code>true</code> to specify that the split pane should provide a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     *        collapse/expand widget
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     *  description: UI widget on the divider to quickly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     *               expand/collapse the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * @see #isOneTouchExpandable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    public void setOneTouchExpandable(boolean newValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
        boolean           oldValue = oneTouchExpandable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        oneTouchExpandable = newValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        oneTouchExpandableSet = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
        firePropertyChange(ONE_TOUCH_EXPANDABLE_PROPERTY, oldValue, newValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * Gets the <code>oneTouchExpandable</code> property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     * @return the value of the <code>oneTouchExpandable</code> property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * @see #setOneTouchExpandable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    public boolean isOneTouchExpandable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
        return oneTouchExpandable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     * Sets the last location the divider was at to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * <code>newLastLocation</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * @param newLastLocation an integer specifying the last divider location
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     *        in pixels, from the left (or upper) edge of the pane to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     *        left (or upper) edge of the divider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     *  description: The last location the divider was at.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    public void setLastDividerLocation(int newLastLocation) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        int               oldLocation = lastDividerLocation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
        lastDividerLocation = newLastLocation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
        firePropertyChange(LAST_DIVIDER_LOCATION_PROPERTY, oldLocation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
                           newLastLocation);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * Returns the last location the divider was at.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * @return an integer specifying the last divider location as a count
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     *       of pixels from the left (or upper) edge of the pane to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     *       left (or upper) edge of the divider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    public int getLastDividerLocation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
        return lastDividerLocation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * Sets the orientation, or how the splitter is divided. The options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * are:<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * <li>JSplitPane.VERTICAL_SPLIT  (above/below orientation of components)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * <li>JSplitPane.HORIZONTAL_SPLIT  (left/right orientation of components)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     * @param orientation an integer specifying the orientation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * @exception IllegalArgumentException if orientation is not one of:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     *        HORIZONTAL_SPLIT or VERTICAL_SPLIT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     *  description: The orientation, or how the splitter is divided.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     *         enum: HORIZONTAL_SPLIT JSplitPane.HORIZONTAL_SPLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     *               VERTICAL_SPLIT   JSplitPane.VERTICAL_SPLIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    public void setOrientation(int orientation) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
        if ((orientation != VERTICAL_SPLIT) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
            (orientation != HORIZONTAL_SPLIT)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
           throw new IllegalArgumentException("JSplitPane: orientation must " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
                                              "be one of " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
                                              "JSplitPane.VERTICAL_SPLIT or " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
                                              "JSplitPane.HORIZONTAL_SPLIT");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
        int           oldOrientation = this.orientation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
        this.orientation = orientation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
        firePropertyChange(ORIENTATION_PROPERTY, oldOrientation, orientation);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * Returns the orientation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * @return an integer giving the orientation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * @see #setOrientation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
    public int getOrientation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
        return orientation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * Sets the value of the <code>continuousLayout</code> property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * which must be <code>true</code> for the child components
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * to be continuously
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * redisplayed and laid out during user intervention.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * The default value of this property is <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * Some look and feels might not support continuous layout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * they will ignore this property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * @param newContinuousLayout  <code>true</code> if the components
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     *        should continuously be redrawn as the divider changes position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     *  description: Whether the child components are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     *               continuously redisplayed and laid out during
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     *               user intervention.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * @see #isContinuousLayout
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
    public void setContinuousLayout(boolean newContinuousLayout) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
        boolean           oldCD = continuousLayout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
        continuousLayout = newContinuousLayout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
        firePropertyChange(CONTINUOUS_LAYOUT_PROPERTY, oldCD,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
                           newContinuousLayout);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     * Gets the <code>continuousLayout</code> property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * @return the value of the <code>continuousLayout</code> property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     * @see #setContinuousLayout
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
    public boolean isContinuousLayout() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
        return continuousLayout;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * Specifies how to distribute extra space when the size of the split pane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * changes. A value of 0, the default,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * indicates the right/bottom component gets all the extra space (the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * left/top component acts fixed), where as a value of 1 specifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     * left/top component gets all the extra space (the right/bottom component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * acts fixed). Specifically, the left/top component gets (weight * diff)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     * extra space and the right/bottom component gets (1 - weight) * diff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * extra space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * @param value as described above
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     * @exception IllegalArgumentException if <code>value</code> is < 0 or > 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     *  description: Specifies how to distribute extra space when the split pane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     *               resizes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
    public void setResizeWeight(double value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
        if (value < 0 || value > 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
            throw new IllegalArgumentException("JSplitPane weight must be between 0 and 1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
        double         oldWeight = resizeWeight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
        resizeWeight = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
        firePropertyChange(RESIZE_WEIGHT_PROPERTY, oldWeight, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
     * Returns the number that determines how extra space is distributed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     * @return how extra space is to be distributed on a resize of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     *         split pane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    public double getResizeWeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
        return resizeWeight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * Lays out the <code>JSplitPane</code> layout based on the preferred size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     * of the children components. This will likely result in changing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     * the divider location.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
    public void resetToPreferredSizes() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
        SplitPaneUI         ui = getUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
        if (ui != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
            ui.resetToPreferredSizes(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * Sets the divider location as a percentage of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * <code>JSplitPane</code>'s size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * This method is implemented in terms of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     * <code>setDividerLocation(int)</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     * This method immediately changes the size of the split pane based on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * its current size. If the split pane is not correctly realized and on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * screen, this method will have no effect (new divider location will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * become (current size * proportionalLocation) which is 0).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * @param proportionalLocation  a double-precision floating point value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     *        that specifies a percentage, from zero (top/left) to 1.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     *        (bottom/right)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     * @exception IllegalArgumentException if the specified location is < 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     *            or > 1.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     *  description: The location of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
    public void setDividerLocation(double proportionalLocation) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
        if (proportionalLocation < 0.0 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
           proportionalLocation > 1.0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
            throw new IllegalArgumentException("proportional location must " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
                                               "be between 0.0 and 1.0.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
        if (getOrientation() == VERTICAL_SPLIT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
            setDividerLocation((int)((double)(getHeight() - getDividerSize()) *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
                                     proportionalLocation));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
            setDividerLocation((int)((double)(getWidth() - getDividerSize()) *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
                                     proportionalLocation));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     * Sets the location of the divider. This is passed off to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     * look and feel implementation, and then listeners are notified. A value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     * less than 0 implies the divider should be reset to a value that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     * attempts to honor the preferred size of the left/top component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * After notifying the listeners, the last divider location is updated,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * via <code>setLastDividerLocation</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * @param location an int specifying a UI-specific value (typically a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     *        pixel count)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     *        bound: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     *  description: The location of the divider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
    public void setDividerLocation(int location) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
        int                 oldValue = dividerLocation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
        dividerLocation = location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
        // Notify UI.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
        SplitPaneUI         ui = getUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
        if (ui != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
            ui.setDividerLocation(this, location);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
        // Then listeners
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
        firePropertyChange(DIVIDER_LOCATION_PROPERTY, oldValue, location);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
        // And update the last divider location.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
        setLastDividerLocation(oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     * Returns the last value passed to <code>setDividerLocation</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     * The value returned from this method may differ from the actual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     * divider location (if <code>setDividerLocation</code> was passed a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     * value bigger than the curent size).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * @return an integer specifying the location of the divider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
    public int getDividerLocation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
        return dividerLocation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * Returns the minimum location of the divider from the look and feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * @return an integer specifying a UI-specific value for the minimum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     *          location (typically a pixel count); or -1 if the UI is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     *          <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     *  description: The minimum location of the divider from the L&F.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
    public int getMinimumDividerLocation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
        SplitPaneUI         ui = getUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
        if (ui != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
            return ui.getMinimumDividerLocation(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     * Returns the maximum location of the divider from the look and feel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     * @return an integer specifying a UI-specific value for the maximum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     *          location (typically a pixel count); or -1 if the  UI is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     *          <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
    public int getMaximumDividerLocation() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        SplitPaneUI         ui = getUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
        if (ui != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
            return ui.getMaximumDividerLocation(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
        return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
     * Removes the child component, <code>component</code> from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     * pane. Resets the <code>leftComponent</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
     * <code>rightComponent</code> instance variable, as necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
     * @param component the <code>Component</code> to remove
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
    public void remove(Component component) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
        if (component == leftComponent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
            leftComponent = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
        } else if (component == rightComponent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
            rightComponent = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
        super.remove(component);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
        // Update the JSplitPane on the screen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
        revalidate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
        repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * Removes the <code>Component</code> at the specified index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     * Updates the <code>leftComponent</code> and <code>rightComponent</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * instance variables as necessary, and then messages super.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * @param index an integer specifying the component to remove, where
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     *        1 specifies the left/top component and 2 specifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
     *        bottom/right component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
    public void remove(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
        Component    comp = getComponent(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
        if (comp == leftComponent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
            leftComponent = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
        } else if (comp == rightComponent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
            rightComponent = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
        super.remove(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
        // Update the JSplitPane on the screen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
        revalidate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
        repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * Removes all the child components from the split pane. Resets the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     * <code>leftComonent</code> and <code>rightComponent</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     * instance variables.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
    public void removeAll() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
        leftComponent = rightComponent = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
        super.removeAll();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
        // Update the JSplitPane on the screen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
        revalidate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
        repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * Returns true, so that calls to <code>revalidate</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * on any descendant of this <code>JSplitPane</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * will cause a request to be queued that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     * will validate the <code>JSplitPane</code> and all its descendants.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     * @return true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * @see JComponent#revalidate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     *    hidden: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
    public boolean isValidateRoot() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     * Adds the specified component to this split pane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
     * If <code>constraints</code> identifies the left/top or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
     * right/bottom child component, and a component with that identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
     * was previously added, it will be removed and then <code>comp</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
     * will be added in its place. If <code>constraints</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
     * one of the known identifiers the layout manager may throw an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     * <code>IllegalArgumentException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
     * The possible constraints objects (Strings) are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
     * <li>JSplitPane.TOP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
     * <li>JSplitPane.LEFT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
     * <li>JSplitPane.BOTTOM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * <li>JSplitPane.RIGHT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * If the <code>constraints</code> object is <code>null</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     * the component is added in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * first available position (left/top if open, else right/bottom).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
     * @param comp        the component to add
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     * @param constraints an <code>Object</code> specifying the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     *                    layout constraints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     *                    (position) for this component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     * @param index       an integer specifying the index in the container's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     *                    list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     * @exception IllegalArgumentException  if the <code>constraints</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     *          object does not match an existing component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * @see java.awt.Container#addImpl(Component, Object, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
    protected void addImpl(Component comp, Object constraints, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
        Component             toRemove;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
        if (constraints != null && !(constraints instanceof String)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
            throw new IllegalArgumentException("cannot add to layout: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
                                               "constraint must be a string " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
                                               "(or null)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
        /* If the constraints are null and the left/right component is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
           invalid, add it at the left/right component. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
        if (constraints == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
            if (getLeftComponent() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
                constraints = JSplitPane.LEFT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
            } else if (getRightComponent() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
                constraints = JSplitPane.RIGHT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
        /* Find the Component that already exists and remove it. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
        if (constraints != null && (constraints.equals(JSplitPane.LEFT) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
                                   constraints.equals(JSplitPane.TOP))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
            toRemove = getLeftComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
            if (toRemove != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
                remove(toRemove);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
            leftComponent = comp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
            index = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
        } else if (constraints != null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
                   (constraints.equals(JSplitPane.RIGHT) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
                    constraints.equals(JSplitPane.BOTTOM))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
            toRemove = getRightComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
            if (toRemove != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
                remove(toRemove);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
            rightComponent = comp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
            index = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
        } else if (constraints != null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
                constraints.equals(JSplitPane.DIVIDER)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
            index = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
        /* LayoutManager should raise for else condition here. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
        super.addImpl(comp, constraints, index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
        // Update the JSplitPane on the screen
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
        revalidate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
        repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
     * Subclassed to message the UI with <code>finishedPaintingChildren</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
     * after super has been messaged, as well as painting the border.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     * @param g the <code>Graphics</code> context within which to paint
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
    protected void paintChildren(Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
        super.paintChildren(g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
        SplitPaneUI        ui = getUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
        if (ui != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
            Graphics           tempG = g.create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
            ui.finishedPaintingChildren(this, tempG);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
            tempG.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
     * See <code>readObject</code> and <code>writeObject</code> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * <code>JComponent</code> for more
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     * information about serialization in Swing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
    private void writeObject(ObjectOutputStream s) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
        s.defaultWriteObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
        if (getUIClassID().equals(uiClassID)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
            byte count = JComponent.getWriteObjCounter(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
            JComponent.setWriteObjCounter(this, --count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
            if (count == 0 && ui != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
                ui.installUI(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
    void setUIProperty(String propertyName, Object value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
        if (propertyName == "dividerSize") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
            if (!dividerSizeSet) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
                setDividerSize(((Number)value).intValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
                dividerSizeSet = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
        } else if (propertyName == "oneTouchExpandable") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
            if (!oneTouchExpandableSet) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
                setOneTouchExpandable(((Boolean)value).booleanValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
                oneTouchExpandableSet = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
            super.setUIProperty(propertyName, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
     * Returns a string representation of this <code>JSplitPane</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
     * This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
     * is intended to be used only for debugging purposes, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
     * content and format of the returned string may vary between
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
     * implementations. The returned string may be empty but may not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
     * be <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
     * @return  a string representation of this <code>JSplitPane</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
    protected String paramString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
        String orientationString = (orientation == HORIZONTAL_SPLIT ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
                                    "HORIZONTAL_SPLIT" : "VERTICAL_SPLIT");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
        String continuousLayoutString = (continuousLayout ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
                                         "true" : "false");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
        String oneTouchExpandableString = (oneTouchExpandable ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
                                           "true" : "false");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
        return super.paramString() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
        ",continuousLayout=" + continuousLayoutString +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
        ",dividerSize=" + dividerSize +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
        ",lastDividerLocation=" + lastDividerLocation +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
        ",oneTouchExpandable=" + oneTouchExpandableString +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
        ",orientation=" + orientationString;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
    ///////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
    // Accessibility support //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
    ///////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
     * Gets the AccessibleContext associated with this JSplitPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
     * For split panes, the AccessibleContext takes the form of an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
     * AccessibleJSplitPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
     * A new AccessibleJSplitPane instance is created if necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
     * @return an AccessibleJSplitPane that serves as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
     *         AccessibleContext of this JSplitPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
     *       expert: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
     *  description: The AccessibleContext associated with this SplitPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
    public AccessibleContext getAccessibleContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
        if (accessibleContext == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
            accessibleContext = new AccessibleJSplitPane();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
        return accessibleContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
     * This class implements accessibility support for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
     * <code>JSplitPane</code> class.  It provides an implementation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
     * Java Accessibility API appropriate to split pane user-interface elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
     * the same version of Swing.  As of 1.4, support for long term storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
     * of all JavaBeans<sup><font size="-2">TM</font></sup>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
    protected class AccessibleJSplitPane extends AccessibleJComponent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
        implements AccessibleValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
         * Gets the state set of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
         * @return an instance of AccessibleState containing the current state
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
         * of the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
         * @see AccessibleState
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
        public AccessibleStateSet getAccessibleStateSet() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
            AccessibleStateSet states = super.getAccessibleStateSet();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
            // FIXME: [[[WDW - Should also add BUSY if this implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
            // Adjustable at some point.  If this happens, we probably
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
            // should also add actions.]]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
            if (getOrientation() == VERTICAL_SPLIT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
                states.add(AccessibleState.VERTICAL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
                states.add(AccessibleState.HORIZONTAL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
            return states;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
         * Get the AccessibleValue associated with this object.  In the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
         * implementation of the Java Accessibility API for this class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
         * return this object, which is responsible for implementing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
         * AccessibleValue interface on behalf of itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
         * @return this object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
        public AccessibleValue getAccessibleValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
            return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
         * Gets the accessible value of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
         * @return a localized String describing the value of this object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
        public Number getCurrentAccessibleValue() {
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1198
            return Integer.valueOf(getDividerLocation());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
         * Sets the value of this object as a Number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
         * @return True if the value was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
        public boolean setCurrentAccessibleValue(Number n) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
            // TIGER - 4422535
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
            if (n == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
            setDividerLocation(n.intValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
         * Gets the minimum accessible value of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
         * @return The minimum value of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
        public Number getMinimumAccessibleValue() {
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1223
            return Integer.valueOf(getUI().getMinimumDividerLocation(
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
                                                        JSplitPane.this));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
         * Gets the maximum accessible value of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
         * @return The maximum value of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
        public Number getMaximumAccessibleValue() {
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1234
            return Integer.valueOf(getUI().getMaximumDividerLocation(
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
                                                        JSplitPane.this));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
         * Gets the role of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
         * @return an instance of AccessibleRole describing the role of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
         * the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
         * @see AccessibleRole
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
        public AccessibleRole getAccessibleRole() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
            return AccessibleRole.SPLIT_PANE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
    } // inner class AccessibleJSplitPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
}