src/java.desktop/share/classes/java/awt/ScrollPane.java

Print this page




 727 
 728         PeerFixer(ScrollPane scroller) {
 729             this.scroller = scroller;
 730         }
 731 
 732         /**
 733          * Invoked when the value of the adjustable has changed.
 734          */
 735         @SuppressWarnings("deprecation")
 736         public void adjustmentValueChanged(AdjustmentEvent e) {
 737             Adjustable adj = e.getAdjustable();
 738             int value = e.getValue();
 739             ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
 740             if (peer != null) {
 741                 peer.setValue(adj, value);
 742             }
 743 
 744             Component c = scroller.getComponent(0);
 745             switch(adj.getOrientation()) {
 746             case Adjustable.VERTICAL:
 747                 c.move(c.getLocation().x, -(value));

 748                 break;
 749             case Adjustable.HORIZONTAL:
 750                 c.move(-(value), c.getLocation().y);

 751                 break;
 752             default:
 753                 throw new IllegalArgumentException("Illegal adjustable orientation");
 754             }
 755         }
 756 
 757         private ScrollPane scroller;
 758     }
 759 
 760 
 761 /////////////////
 762 // Accessibility support
 763 ////////////////
 764 
 765     /**
 766      * Gets the AccessibleContext associated with this ScrollPane.
 767      * For scroll panes, the AccessibleContext takes the form of an
 768      * AccessibleAWTScrollPane.
 769      * A new AccessibleAWTScrollPane instance is created if necessary.
 770      *




 727 
 728         PeerFixer(ScrollPane scroller) {
 729             this.scroller = scroller;
 730         }
 731 
 732         /**
 733          * Invoked when the value of the adjustable has changed.
 734          */
 735         @SuppressWarnings("deprecation")
 736         public void adjustmentValueChanged(AdjustmentEvent e) {
 737             Adjustable adj = e.getAdjustable();
 738             int value = e.getValue();
 739             ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
 740             if (peer != null) {
 741                 peer.setValue(adj, value);
 742             }
 743 
 744             Component c = scroller.getComponent(0);
 745             switch(adj.getOrientation()) {
 746             case Adjustable.VERTICAL:
 747                 c.move(c.getLocation().x,
 748                         -(value) + ScrollPane.this.getInsets().top);
 749                 break;
 750             case Adjustable.HORIZONTAL:
 751                 c.move(-(value) + ScrollPane.this.getInsets().left,
 752                         c.getLocation().y);
 753                 break;
 754             default:
 755                 throw new IllegalArgumentException("Illegal adjustable orientation");
 756             }
 757         }
 758 
 759         private ScrollPane scroller;
 760     }
 761 
 762 
 763 /////////////////
 764 // Accessibility support
 765 ////////////////
 766 
 767     /**
 768      * Gets the AccessibleContext associated with this ScrollPane.
 769      * For scroll panes, the AccessibleContext takes the form of an
 770      * AccessibleAWTScrollPane.
 771      * A new AccessibleAWTScrollPane instance is created if necessary.
 772      *