642 /**
643 * Removes an AdjustmentEvent listener.
644 *
645 * @param l the AdjustmentLister to remove
646 * @see #addAdjustmentListener
647 */
648 public void removeAdjustmentListener(AdjustmentListener l) {
649 listenerList.remove(AdjustmentListener.class, l);
650 }
651
652
653 /**
654 * Returns an array of all the <code>AdjustmentListener</code>s added
655 * to this JScrollBar with addAdjustmentListener().
656 *
657 * @return all of the <code>AdjustmentListener</code>s added or an empty
658 * array if no listeners have been added
659 * @since 1.4
660 */
661 public AdjustmentListener[] getAdjustmentListeners() {
662 return (AdjustmentListener[])listenerList.getListeners(
663 AdjustmentListener.class);
664 }
665
666
667 /**
668 * Notify listeners that the scrollbar's model has changed.
669 *
670 * @see #addAdjustmentListener
671 * @see EventListenerList
672 */
673 protected void fireAdjustmentValueChanged(int id, int type, int value) {
674 fireAdjustmentValueChanged(id, type, value, getValueIsAdjusting());
675 }
676
677 /**
678 * Notify listeners that the scrollbar's model has changed.
679 *
680 * @see #addAdjustmentListener
681 * @see EventListenerList
682 */
683 private void fireAdjustmentValueChanged(int id, int type, int value,
737 */
738 public Dimension getMaximumSize() {
739 Dimension pref = getPreferredSize();
740 if (getOrientation() == VERTICAL) {
741 return new Dimension(pref.width, Short.MAX_VALUE);
742 } else {
743 return new Dimension(Short.MAX_VALUE, pref.height);
744 }
745 }
746
747 /**
748 * Enables the component so that the knob position can be changed.
749 * When the disabled, the knob position cannot be changed.
750 *
751 * @param x a boolean value, where true enables the component and
752 * false disables it
753 */
754 public void setEnabled(boolean x) {
755 super.setEnabled(x);
756 Component[] children = getComponents();
757 for(int i = 0; i < children.length; i++) {
758 children[i].setEnabled(x);
759 }
760 }
761
762 /**
763 * See readObject() and writeObject() in JComponent for more
764 * information about serialization in Swing.
765 */
766 private void writeObject(ObjectOutputStream s) throws IOException {
767 s.defaultWriteObject();
768 if (getUIClassID().equals(uiClassID)) {
769 byte count = JComponent.getWriteObjCounter(this);
770 JComponent.setWriteObjCounter(this, --count);
771 if (count == 0 && ui != null) {
772 ui.installUI(this);
773 }
774 }
775 }
776
777
778 /**
|
642 /**
643 * Removes an AdjustmentEvent listener.
644 *
645 * @param l the AdjustmentLister to remove
646 * @see #addAdjustmentListener
647 */
648 public void removeAdjustmentListener(AdjustmentListener l) {
649 listenerList.remove(AdjustmentListener.class, l);
650 }
651
652
653 /**
654 * Returns an array of all the <code>AdjustmentListener</code>s added
655 * to this JScrollBar with addAdjustmentListener().
656 *
657 * @return all of the <code>AdjustmentListener</code>s added or an empty
658 * array if no listeners have been added
659 * @since 1.4
660 */
661 public AdjustmentListener[] getAdjustmentListeners() {
662 return listenerList.getListeners(AdjustmentListener.class);
663 }
664
665
666 /**
667 * Notify listeners that the scrollbar's model has changed.
668 *
669 * @see #addAdjustmentListener
670 * @see EventListenerList
671 */
672 protected void fireAdjustmentValueChanged(int id, int type, int value) {
673 fireAdjustmentValueChanged(id, type, value, getValueIsAdjusting());
674 }
675
676 /**
677 * Notify listeners that the scrollbar's model has changed.
678 *
679 * @see #addAdjustmentListener
680 * @see EventListenerList
681 */
682 private void fireAdjustmentValueChanged(int id, int type, int value,
736 */
737 public Dimension getMaximumSize() {
738 Dimension pref = getPreferredSize();
739 if (getOrientation() == VERTICAL) {
740 return new Dimension(pref.width, Short.MAX_VALUE);
741 } else {
742 return new Dimension(Short.MAX_VALUE, pref.height);
743 }
744 }
745
746 /**
747 * Enables the component so that the knob position can be changed.
748 * When the disabled, the knob position cannot be changed.
749 *
750 * @param x a boolean value, where true enables the component and
751 * false disables it
752 */
753 public void setEnabled(boolean x) {
754 super.setEnabled(x);
755 Component[] children = getComponents();
756 for (Component child : children) {
757 child.setEnabled(x);
758 }
759 }
760
761 /**
762 * See readObject() and writeObject() in JComponent for more
763 * information about serialization in Swing.
764 */
765 private void writeObject(ObjectOutputStream s) throws IOException {
766 s.defaultWriteObject();
767 if (getUIClassID().equals(uiClassID)) {
768 byte count = JComponent.getWriteObjCounter(this);
769 JComponent.setWriteObjCounter(this, --count);
770 if (count == 0 && ui != null) {
771 ui.installUI(this);
772 }
773 }
774 }
775
776
777 /**
|