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

Print this page

        

*** 20,50 **** * * 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 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% --- 20,47 ---- * * 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.beans.JavaBean; ! import java.beans.BeanProperty; import javax.swing.event.*; import javax.swing.plaf.*; import javax.accessibility.*; import java.io.ObjectOutputStream; 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,86 **** * of all JavaBeans&trade; * 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 */ @SuppressWarnings("serial") // Same-version serialization only public class JScrollBar extends JComponent implements Adjustable, Accessible { /** * @see #getUIClassID --- 67,82 ---- * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see JScrollPane * * @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,220 **** * 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 */ public void setUI(ScrollBarUI ui) { super.setUI(ui); } --- 201,213 ---- * 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 */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel") public void setUI(ScrollBarUI ui) { super.setUI(ui); }
*** 244,253 **** --- 237,247 ---- * * @return "ScrollBarUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; }
*** 269,286 **** * 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 */ public void setOrientation(int orientation) { checkOrientation(orientation); int oldValue = this.orientation; this.orientation = orientation; --- 263,277 ---- * HORIZONTAL. * * @param orientation an orientation of the {@code JScrollBar} * @exception IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL * @see #getOrientation */ + @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,331 **** * 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. */ public void setModel(BoundedRangeModel newModel) { Integer oldValue = null; BoundedRangeModel oldModel = model; if (model != null) { model.removeChangeListener(fwdAdjustmentEvents); --- 308,320 ---- * Sets the model that handles the scrollbar's four * fundamental properties: minimum, maximum, value, extent. * * @param newModel a new model * @see #getModel */ + @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,396 **** * <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. */ public void setUnitIncrement(int unitIncrement) { int oldValue = this.unitIncrement; this.unitIncrement = unitIncrement; firePropertyChange("unitIncrement", oldValue, unitIncrement); } --- 371,383 ---- * <p> * Some look and feels implement custom scrolling behavior * and ignore this property. * * @see #getUnitIncrement */ + @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,446 **** * <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. */ public void setBlockIncrement(int blockIncrement) { int oldValue = this.blockIncrement; this.blockIncrement = blockIncrement; firePropertyChange("blockIncrement", oldValue, blockIncrement); } --- 419,431 ---- * <p> * Some look and feels implement custom scrolling behavior * and ignore this property. * * @see #getBlockIncrement() */ + @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,493 **** * 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. */ public void setValue(int value) { BoundedRangeModel m = getModel(); int oldValue = m.getValue(); m.setValue(value); --- 465,477 ---- * Sets the scrollbar's value. This method just forwards the value * to the model. * * @see #getValue * @see BoundedRangeModel#setValue */ + @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,529 **** /** * Set the model's extent property. * * @see #getVisibleAmount * @see BoundedRangeModel#setExtent - * @beaninfo - * preferred: true - * description: The amount of the view that is currently visible. */ public void setVisibleAmount(int extent) { getModel().setExtent(extent); } --- 500,512 ---- /** * Set the model's extent property. * * @see #getVisibleAmount * @see BoundedRangeModel#setExtent */ + @BeanProperty(bound = false, preferred = true, description + = "The amount of the view that is currently visible.") public void setVisibleAmount(int extent) { getModel().setExtent(extent); }
*** 542,555 **** /** * Sets the model's minimum property. * * @see #getMinimum * @see BoundedRangeModel#setMinimum - * @beaninfo - * preferred: true - * description: The scrollbar's minimum value. */ public void setMinimum(int minimum) { getModel().setMinimum(minimum); } --- 525,537 ---- /** * Sets the model's minimum property. * * @see #getMinimum * @see BoundedRangeModel#setMinimum */ + @BeanProperty(bound = false, preferred = true, description + = "The scrollbar's minimum value.") public void setMinimum(int minimum) { getModel().setMinimum(minimum); }
*** 568,581 **** * 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. */ public void setMaximum(int maximum) { getModel().setMaximum(maximum); } --- 550,562 ---- * Sets the model's maximum property. Note that the scrollbar's value * can only be set to maximum - extent. * * @see #getMaximum * @see BoundedRangeModel#setMaximum */ + @BeanProperty(bound = false, preferred = true, description + = "The scrollbar's maximum value.") public void setMaximum(int maximum) { getModel().setMaximum(maximum); }
*** 599,612 **** * * @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. */ public void setValueIsAdjusting(boolean b) { BoundedRangeModel m = getModel(); boolean oldValue = m.getValueIsAdjusting(); m.setValueIsAdjusting(b); --- 580,592 ---- * * @param b {@code true} if the upcoming changes to the value property are part of a series * * @see #getValueIsAdjusting * @see BoundedRangeModel#setValueIsAdjusting */ + @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,700 **** --- 671,681 ---- * * @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,852 **** --- 824,834 ---- * 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;