jdk/src/share/classes/javax/swing/JScrollBar.java

Print this page

        

@@ -20,31 +20,28 @@
  *
  * 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.io.Serializable;
 import java.awt.Component;
 import java.awt.Adjustable;
 import java.awt.Dimension;
 import java.awt.event.AdjustmentListener;
 import java.awt.event.AdjustmentEvent;
-import java.awt.Graphics;
+import java.beans.JavaBean;
+import java.beans.BeanProperty;
 
 import javax.swing.event.*;
 import javax.swing.plaf.*;
 import javax.accessibility.*;
 
 import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
 import java.io.IOException;
 
-
-
 /**
  * An implementation of a scrollbar. The user positions the knob in the
  * scrollbar to determine the contents of the viewing area. The
  * program typically adjusts the display so that the end of the
  * scrollbar represents the end of the displayable contents, or 100%

@@ -70,17 +67,16 @@
  * of all JavaBeans™
  * has been added to the <code>java.beans</code> package.
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @see JScrollPane
- * @beaninfo
- *      attribute: isContainer false
- *    description: A component that helps determine the visible content range of an area.
  *
  * @author David Kloba
  * @since 1.2
  */
+@JavaBean(defaultProperty = "UI", description = "A component that helps determine the visible content range of an area.")
+@SwingContainer(false)
 @SuppressWarnings("serial") // Same-version serialization only
 public class JScrollBar extends JComponent implements Adjustable, Accessible
 {
     /**
      * @see #getUIClassID

@@ -205,16 +201,13 @@
      * Sets the {@literal L&F} object that renders this component.
      *
      * @param ui  the <code>ScrollBarUI</code> {@literal L&F} object
      * @see UIDefaults#getUI
      * @since 1.4
-     * @beaninfo
-     *        bound: true
-     *       hidden: true
-     *    attribute: visualUpdate true
-     *  description: The UI object that implements the Component's LookAndFeel
      */
+    @BeanProperty(hidden = true, visualUpdate = true, description
+            = "The UI object that implements the Component's LookAndFeel")
     public void setUI(ScrollBarUI ui) {
         super.setUI(ui);
     }
 
 

@@ -244,10 +237,11 @@
      *
      * @return "ScrollBarUI"
      * @see JComponent#getUIClassID
      * @see UIDefaults#getUI
      */
+    @BeanProperty(bound = false)
     public String getUIClassID() {
         return uiClassID;
     }
 
 

@@ -269,18 +263,15 @@
      * HORIZONTAL.
      *
      * @param orientation an orientation of the {@code JScrollBar}
      * @exception IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL
      * @see #getOrientation
-     * @beaninfo
-     *    preferred: true
-     *        bound: true
-     *    attribute: visualUpdate true
-     *  description: The scrollbar's orientation.
-     *         enum: VERTICAL JScrollBar.VERTICAL
-     *               HORIZONTAL JScrollBar.HORIZONTAL
      */
+    @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = {
+            "JScrollBar.VERTICAL",
+            "JScrollBar.HORIZONTAL"}, description
+            = "The scrollbar's orientation.")
     public void setOrientation(int orientation)
     {
         checkOrientation(orientation);
         int oldValue = this.orientation;
         this.orientation = orientation;

@@ -317,15 +308,13 @@
      * Sets the model that handles the scrollbar's four
      * fundamental properties: minimum, maximum, value, extent.
      *
      * @param newModel a new model
      * @see #getModel
-     * @beaninfo
-     *       bound: true
-     *       expert: true
-     * description: The scrollbar's BoundedRangeModel.
      */
+    @BeanProperty(expert = true, description
+            = "The scrollbar's BoundedRangeModel.")
     public void setModel(BoundedRangeModel newModel) {
         Integer oldValue = null;
         BoundedRangeModel oldModel = model;
         if (model != null) {
             model.removeChangeListener(fwdAdjustmentEvents);

@@ -382,15 +371,13 @@
      * <p>
      * Some look and feels implement custom scrolling behavior
      * and ignore this property.
      *
      * @see #getUnitIncrement
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The scrollbar's unit increment.
      */
+    @BeanProperty(preferred = true, description
+            = "The scrollbar's unit increment.")
     public void setUnitIncrement(int unitIncrement) {
         int oldValue = this.unitIncrement;
         this.unitIncrement = unitIncrement;
         firePropertyChange("unitIncrement", oldValue, unitIncrement);
     }

@@ -432,15 +419,13 @@
      * <p>
      * Some look and feels implement custom scrolling behavior
      * and ignore this property.
      *
      * @see #getBlockIncrement()
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The scrollbar's block increment.
      */
+    @BeanProperty(preferred = true, description
+            = "The scrollbar's block increment.")
     public void setBlockIncrement(int blockIncrement) {
         int oldValue = this.blockIncrement;
         this.blockIncrement = blockIncrement;
         firePropertyChange("blockIncrement", oldValue, blockIncrement);
     }

@@ -480,14 +465,13 @@
      * Sets the scrollbar's value.  This method just forwards the value
      * to the model.
      *
      * @see #getValue
      * @see BoundedRangeModel#setValue
-     * @beaninfo
-     *   preferred: true
-     * description: The scrollbar's current value.
      */
+    @BeanProperty(bound = false, preferred = true, description
+            = "The scrollbar's current value.")
     public void setValue(int value) {
         BoundedRangeModel m = getModel();
         int oldValue = m.getValue();
         m.setValue(value);
 

@@ -516,14 +500,13 @@
     /**
      * Set the model's extent property.
      *
      * @see #getVisibleAmount
      * @see BoundedRangeModel#setExtent
-     * @beaninfo
-     *   preferred: true
-     * description: The amount of the view that is currently visible.
      */
+    @BeanProperty(bound = false, preferred = true, description
+            = "The amount of the view that is currently visible.")
     public void setVisibleAmount(int extent) {
         getModel().setExtent(extent);
     }
 
 

@@ -542,14 +525,13 @@
     /**
      * Sets the model's minimum property.
      *
      * @see #getMinimum
      * @see BoundedRangeModel#setMinimum
-     * @beaninfo
-     *   preferred: true
-     * description: The scrollbar's minimum value.
      */
+    @BeanProperty(bound = false, preferred = true, description
+            = "The scrollbar's minimum value.")
     public void setMinimum(int minimum) {
         getModel().setMinimum(minimum);
     }
 
 

@@ -568,14 +550,13 @@
      * Sets the model's maximum property.  Note that the scrollbar's value
      * can only be set to maximum - extent.
      *
      * @see #getMaximum
      * @see BoundedRangeModel#setMaximum
-     * @beaninfo
-     *   preferred: true
-     * description: The scrollbar's maximum value.
      */
+    @BeanProperty(bound = false, preferred = true, description
+            = "The scrollbar's maximum value.")
     public void setMaximum(int maximum) {
         getModel().setMaximum(maximum);
     }
 
 

@@ -599,14 +580,13 @@
      *
      * @param b {@code true} if the upcoming changes to the value property are part of a series
      *
      * @see #getValueIsAdjusting
      * @see BoundedRangeModel#setValueIsAdjusting
-     * @beaninfo
-     *      expert: true
-     * description: True if the scrollbar thumb is being dragged.
      */
+    @BeanProperty(bound = false, expert = true, description
+            = "True if the scrollbar thumb is being dragged.")
     public void setValueIsAdjusting(boolean b) {
         BoundedRangeModel m = getModel();
         boolean oldValue = m.getValueIsAdjusting();
         m.setValueIsAdjusting(b);
 

@@ -691,10 +671,11 @@
      *
      * @return all of the <code>AdjustmentListener</code>s added or an empty
      *         array if no listeners have been added
      * @since 1.4
      */
+    @BeanProperty(bound = false)
     public AdjustmentListener[] getAdjustmentListeners() {
         return listenerList.getListeners(AdjustmentListener.class);
     }
 
 

@@ -843,10 +824,11 @@
      * A new AccessibleJScrollBar instance is created if necessary.
      *
      * @return an AccessibleJScrollBar that serves as the
      *         AccessibleContext of this JScrollBar
      */
+    @BeanProperty(bound = false)
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessibleJScrollBar();
         }
         return accessibleContext;