jdk/src/share/classes/javax/swing/JSplitPane.java
Print this page
*** 21,48 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
-
package javax.swing;
!
!
import java.beans.ConstructorProperties;
import javax.swing.plaf.*;
import javax.accessibility.*;
import java.awt.*;
import java.io.ObjectOutputStream;
- import java.io.ObjectInputStream;
import java.io.IOException;
-
-
/**
* <code>JSplitPane</code> is used to divide two (and only two)
* <code>Component</code>s. The two <code>Component</code>s
* are graphically divided based on the look and feel
* implementation, and the two <code>Component</code>s can then be
--- 21,43 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.swing;
! import java.beans.JavaBean;
! import java.beans.BeanProperty;
import java.beans.ConstructorProperties;
import javax.swing.plaf.*;
import javax.accessibility.*;
import java.awt.*;
import java.io.ObjectOutputStream;
import java.io.IOException;
/**
* <code>JSplitPane</code> is used to divide two (and only two)
* <code>Component</code>s. The two <code>Component</code>s
* are graphically divided based on the look and feel
* implementation, and the two <code>Component</code>s can then be
*** 97,106 ****
--- 92,102 ----
* @see #resetToPreferredSizes
*
* @author Scott Violet
* @since 1.2
*/
+ @JavaBean(defaultProperty = "UI")
@SuppressWarnings("serial") // Same-version serialization only
public class JSplitPane extends JComponent implements Accessible
{
/**
* @see #getUIClassID
*** 363,377 ****
/**
* Sets the L&F object that renders this component.
*
* @param ui the <code>SplitPaneUI</code> L&F object
* @see UIDefaults#getUI
- * @beaninfo
- * bound: true
- * hidden: true
- * attribute: visualUpdate true
- * description: The UI object that implements the Component's LookAndFeel.
*/
public void setUI(SplitPaneUI ui) {
if ((SplitPaneUI)this.ui != ui) {
super.setUI(ui);
revalidate();
--- 359,368 ----
*** 382,395 ****
/**
* Returns the <code>SplitPaneUI</code> that is providing the
* current look and feel.
*
* @return the <code>SplitPaneUI</code> object that renders this component
- * @beaninfo
- * expert: true
- * description: The L&F object that renders this component.
*/
public SplitPaneUI getUI() {
return (SplitPaneUI)ui;
}
--- 373,385 ----
/**
* Returns the <code>SplitPaneUI</code> that is providing the
* current look and feel.
*
* @return the <code>SplitPaneUI</code> object that renders this component
*/
+ @BeanProperty(bound = false, expert = true, description
+ = "The L&F object that renders this component.")
public SplitPaneUI getUI() {
return (SplitPaneUI)ui;
}
*** 410,436 ****
* Returns the name of the L&F class that renders this component.
*
* @return the string "SplitPaneUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
- * @beaninfo
- * expert: true
- * description: A string that specifies the name of the L&F class.
*/
public String getUIClassID() {
return uiClassID;
}
/**
* Sets the size of the divider.
*
* @param newSize an integer giving the size of the divider in pixels
- * @beaninfo
- * bound: true
- * description: The size of the divider.
*/
public void setDividerSize(int newSize) {
int oldSize = dividerSize;
dividerSizeSet = true;
if (oldSize != newSize) {
--- 400,424 ----
* Returns the name of the L&F class that renders this component.
*
* @return the string "SplitPaneUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
+ @BeanProperty(bound = false, expert = true, description
+ = "A string that specifies the name of the L&F class.")
public String getUIClassID() {
return uiClassID;
}
/**
* Sets the size of the divider.
*
* @param newSize an integer giving the size of the divider in pixels
*/
+ @BeanProperty(description
+ = "The size of the divider.")
public void setDividerSize(int newSize) {
int oldSize = dividerSize;
dividerSizeSet = true;
if (oldSize != newSize) {
*** 469,494 ****
/**
* Returns the component to the left (or above) the divider.
*
* @return the <code>Component</code> displayed in that position
- * @beaninfo
- * preferred: true
- * description: The component to the left (or above) the divider.
*/
public Component getLeftComponent() {
return leftComponent;
}
/**
* Sets the component above, or to the left of the divider.
*
* @param comp the <code>Component</code> to display in that position
- * @beaninfo
- * description: The component above, or to the left of the divider.
*/
public void setTopComponent(Component comp) {
setLeftComponent(comp);
}
--- 457,481 ----
/**
* Returns the component to the left (or above) the divider.
*
* @return the <code>Component</code> displayed in that position
*/
+ @BeanProperty(bound = false, preferred = true, description
+ = "The component to the left (or above) the divider.")
public Component getLeftComponent() {
return leftComponent;
}
/**
* Sets the component above, or to the left of the divider.
*
* @param comp the <code>Component</code> to display in that position
*/
+ @BeanProperty(bound = false, description
+ = "The component above, or to the left of the divider.")
public void setTopComponent(Component comp) {
setLeftComponent(comp);
}
*** 504,517 ****
/**
* Sets the component to the right (or below) the divider.
*
* @param comp the <code>Component</code> to display in that position
- * @beaninfo
- * preferred: true
- * description: The component to the right (or below) the divider.
*/
public void setRightComponent(Component comp) {
if (comp == null) {
if (rightComponent != null) {
remove(rightComponent);
rightComponent = null;
--- 491,503 ----
/**
* Sets the component to the right (or below) the divider.
*
* @param comp the <code>Component</code> to display in that position
*/
+ @BeanProperty(bound = false, preferred = true, description
+ = "The component to the right (or below) the divider.")
public void setRightComponent(Component comp) {
if (comp == null) {
if (rightComponent != null) {
remove(rightComponent);
rightComponent = null;
*** 534,546 ****
/**
* Sets the component below, or to the right of the divider.
*
* @param comp the <code>Component</code> to display in that position
- * @beaninfo
- * description: The component below, or to the right of the divider.
*/
public void setBottomComponent(Component comp) {
setRightComponent(comp);
}
--- 520,532 ----
/**
* Sets the component below, or to the right of the divider.
*
* @param comp the <code>Component</code> to display in that position
*/
+ @BeanProperty(bound = false, description
+ = "The component below, or to the right of the divider.")
public void setBottomComponent(Component comp) {
setRightComponent(comp);
}
*** 563,579 ****
* Some look and feels might not support one-touch expanding;
* they will ignore this property.
*
* @param newValue <code>true</code> to specify that the split pane should provide a
* collapse/expand widget
- * @beaninfo
- * bound: true
- * description: UI widget on the divider to quickly
- * expand/collapse the divider.
*
* @see #isOneTouchExpandable
*/
public void setOneTouchExpandable(boolean newValue) {
boolean oldValue = oneTouchExpandable;
oneTouchExpandable = newValue;
oneTouchExpandableSet = true;
--- 549,563 ----
* Some look and feels might not support one-touch expanding;
* they will ignore this property.
*
* @param newValue <code>true</code> to specify that the split pane should provide a
* collapse/expand widget
*
* @see #isOneTouchExpandable
*/
+ @BeanProperty(description
+ = "UI widget on the divider to quickly expand/collapse the divider.")
public void setOneTouchExpandable(boolean newValue) {
boolean oldValue = oneTouchExpandable;
oneTouchExpandable = newValue;
oneTouchExpandableSet = true;
*** 598,611 ****
* <code>newLastLocation</code>.
*
* @param newLastLocation an integer specifying the last divider location
* in pixels, from the left (or upper) edge of the pane to the
* left (or upper) edge of the divider
- * @beaninfo
- * bound: true
- * description: The last location the divider was at.
*/
public void setLastDividerLocation(int newLastLocation) {
int oldLocation = lastDividerLocation;
lastDividerLocation = newLastLocation;
firePropertyChange(LAST_DIVIDER_LOCATION_PROPERTY, oldLocation,
--- 582,594 ----
* <code>newLastLocation</code>.
*
* @param newLastLocation an integer specifying the last divider location
* in pixels, from the left (or upper) edge of the pane to the
* left (or upper) edge of the divider
*/
+ @BeanProperty(description
+ = "The last location the divider was at.")
public void setLastDividerLocation(int newLastLocation) {
int oldLocation = lastDividerLocation;
lastDividerLocation = newLastLocation;
firePropertyChange(LAST_DIVIDER_LOCATION_PROPERTY, oldLocation,
*** 633,648 ****
* </ul>
*
* @param orientation an integer specifying the orientation
* @exception IllegalArgumentException if orientation is not one of:
* HORIZONTAL_SPLIT or VERTICAL_SPLIT.
- * @beaninfo
- * bound: true
- * description: The orientation, or how the splitter is divided.
- * enum: HORIZONTAL_SPLIT JSplitPane.HORIZONTAL_SPLIT
- * VERTICAL_SPLIT JSplitPane.VERTICAL_SPLIT
*/
public void setOrientation(int orientation) {
if ((orientation != VERTICAL_SPLIT) &&
(orientation != HORIZONTAL_SPLIT)) {
throw new IllegalArgumentException("JSplitPane: orientation must " +
"be one of " +
--- 616,630 ----
* </ul>
*
* @param orientation an integer specifying the orientation
* @exception IllegalArgumentException if orientation is not one of:
* HORIZONTAL_SPLIT or VERTICAL_SPLIT.
*/
+ @BeanProperty(enumerationValues = {
+ "JSplitPane.HORIZONTAL_SPLIT",
+ "JSplitPane.VERTICAL_SPLIT"}, description
+ = "The orientation, or how the splitter is divided.")
public void setOrientation(int orientation) {
if ((orientation != VERTICAL_SPLIT) &&
(orientation != HORIZONTAL_SPLIT)) {
throw new IllegalArgumentException("JSplitPane: orientation must " +
"be one of " +
*** 677,693 ****
* Some look and feels might not support continuous layout;
* they will ignore this property.
*
* @param newContinuousLayout <code>true</code> if the components
* should continuously be redrawn as the divider changes position
- * @beaninfo
- * bound: true
- * description: Whether the child components are
- * continuously redisplayed and laid out during
- * user intervention.
* @see #isContinuousLayout
*/
public void setContinuousLayout(boolean newContinuousLayout) {
boolean oldCD = continuousLayout;
continuousLayout = newContinuousLayout;
firePropertyChange(CONTINUOUS_LAYOUT_PROPERTY, oldCD,
--- 659,672 ----
* Some look and feels might not support continuous layout;
* they will ignore this property.
*
* @param newContinuousLayout <code>true</code> if the components
* should continuously be redrawn as the divider changes position
* @see #isContinuousLayout
*/
+ @BeanProperty(description
+ = "Whether the child components are continuously redisplayed and laid out during user intervention.")
public void setContinuousLayout(boolean newContinuousLayout) {
boolean oldCD = continuousLayout;
continuousLayout = newContinuousLayout;
firePropertyChange(CONTINUOUS_LAYOUT_PROPERTY, oldCD,
*** 716,730 ****
* extra space.
*
* @param value as described above
* @exception IllegalArgumentException if <code>value</code> is < 0 or > 1
* @since 1.3
- * @beaninfo
- * bound: true
- * description: Specifies how to distribute extra space when the split pane
- * resizes.
*/
public void setResizeWeight(double value) {
if (value < 0 || value > 1) {
throw new IllegalArgumentException("JSplitPane weight must be between 0 and 1");
}
double oldWeight = resizeWeight;
--- 695,707 ----
* extra space.
*
* @param value as described above
* @exception IllegalArgumentException if <code>value</code> is < 0 or > 1
* @since 1.3
*/
+ @BeanProperty(description
+ = "Specifies how to distribute extra space when the split pane resizes.")
public void setResizeWeight(double value) {
if (value < 0 || value > 1) {
throw new IllegalArgumentException("JSplitPane weight must be between 0 and 1");
}
double oldWeight = resizeWeight;
*** 771,783 ****
* @param proportionalLocation a double-precision floating point value
* that specifies a percentage, from zero (top/left) to 1.0
* (bottom/right)
* @exception IllegalArgumentException if the specified location is < 0
* or > 1.0
- * @beaninfo
- * description: The location of the divider.
*/
public void setDividerLocation(double proportionalLocation) {
if (proportionalLocation < 0.0 ||
proportionalLocation > 1.0) {
throw new IllegalArgumentException("proportional location must " +
"be between 0.0 and 1.0.");
--- 748,760 ----
* @param proportionalLocation a double-precision floating point value
* that specifies a percentage, from zero (top/left) to 1.0
* (bottom/right)
* @exception IllegalArgumentException if the specified location is < 0
* or > 1.0
*/
+ @BeanProperty(description
+ = "The location of the divider.")
public void setDividerLocation(double proportionalLocation) {
if (proportionalLocation < 0.0 ||
proportionalLocation > 1.0) {
throw new IllegalArgumentException("proportional location must " +
"be between 0.0 and 1.0.");
*** 800,813 ****
* After notifying the listeners, the last divider location is updated,
* via <code>setLastDividerLocation</code>.
*
* @param location an int specifying a UI-specific value (typically a
* pixel count)
- * @beaninfo
- * bound: true
- * description: The location of the divider.
*/
public void setDividerLocation(int location) {
int oldValue = dividerLocation;
dividerLocation = location;
--- 777,789 ----
* After notifying the listeners, the last divider location is updated,
* via <code>setLastDividerLocation</code>.
*
* @param location an int specifying a UI-specific value (typically a
* pixel count)
*/
+ @BeanProperty(description
+ = "The location of the divider.")
public void setDividerLocation(int location) {
int oldValue = dividerLocation;
dividerLocation = location;
*** 844,856 ****
* implementation.
*
* @return an integer specifying a UI-specific value for the minimum
* location (typically a pixel count); or -1 if the UI is
* <code>null</code>
- * @beaninfo
- * description: The minimum location of the divider from the L&F.
*/
public int getMinimumDividerLocation() {
SplitPaneUI ui = getUI();
if (ui != null) {
return ui.getMinimumDividerLocation(this);
--- 820,832 ----
* implementation.
*
* @return an integer specifying a UI-specific value for the minimum
* location (typically a pixel count); or -1 if the UI is
* <code>null</code>
*/
+ @BeanProperty(bound = false, description
+ = "The minimum location of the divider from the L&F.")
public int getMinimumDividerLocation() {
SplitPaneUI ui = getUI();
if (ui != null) {
return ui.getMinimumDividerLocation(this);
*** 865,874 ****
--- 841,851 ----
*
* @return an integer specifying a UI-specific value for the maximum
* location (typically a pixel count); or -1 if the UI is
* <code>null</code>
*/
+ @BeanProperty(bound = false)
public int getMaximumDividerLocation() {
SplitPaneUI ui = getUI();
if (ui != null) {
return ui.getMaximumDividerLocation(this);
*** 945,959 ****
* will validate the <code>JSplitPane</code> and all its descendants.
*
* @return true
* @see JComponent#revalidate
* @see java.awt.Container#isValidateRoot
- *
- * @beaninfo
- * hidden: true
*/
@Override
public boolean isValidateRoot() {
return true;
}
--- 922,934 ----
* will validate the <code>JSplitPane</code> and all its descendants.
*
* @return true
* @see JComponent#revalidate
* @see java.awt.Container#isValidateRoot
*/
@Override
+ @BeanProperty(hidden = true)
public boolean isValidateRoot() {
return true;
}
*** 1130,1143 ****
* AccessibleJSplitPane.
* A new AccessibleJSplitPane instance is created if necessary.
*
* @return an AccessibleJSplitPane that serves as the
* AccessibleContext of this JSplitPane
- * @beaninfo
- * expert: true
- * description: The AccessibleContext associated with this SplitPane.
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJSplitPane();
}
return accessibleContext;
--- 1105,1117 ----
* AccessibleJSplitPane.
* A new AccessibleJSplitPane instance is created if necessary.
*
* @return an AccessibleJSplitPane that serves as the
* AccessibleContext of this JSplitPane
*/
+ @BeanProperty(bound = false, expert = true, description
+ = "The AccessibleContext associated with this SplitPane.")
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJSplitPane();
}
return accessibleContext;