< prev index next >

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

Print this page




 715 //          // read unrelated objects further down the stream (4352819).
 716 //      }
 717 //      else {
 718 //          // Reading data from 1.4 or later, it's ok to try to read
 719 //          // optional data as OptionalDataException with eof == true
 720 //          // will be correctly reported
 721 //      }
 722     }
 723 
 724     class PeerFixer implements AdjustmentListener, java.io.Serializable
 725     {
 726         private static final long serialVersionUID = 1043664721353696630L;
 727 
 728         PeerFixer(ScrollPane scroller) {
 729             this.scroller = scroller;
 730         }
 731 
 732         /**
 733          * Invoked when the value of the adjustable has changed.
 734          */

 735         public void adjustmentValueChanged(AdjustmentEvent e) {
 736             Adjustable adj = e.getAdjustable();
 737             int value = e.getValue();
 738             ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
 739             if (peer != null) {
 740                 peer.setValue(adj, value);
 741             }
 742 
 743             Component c = scroller.getComponent(0);
 744             switch(adj.getOrientation()) {
 745             case Adjustable.VERTICAL:
 746                 c.move(c.getLocation().x, -(value));
 747                 break;
 748             case Adjustable.HORIZONTAL:
 749                 c.move(-(value), c.getLocation().y);
 750                 break;
 751             default:
 752                 throw new IllegalArgumentException("Illegal adjustable orientation");
 753             }
 754         }


 814  * Instead of moving it back out here, which would break all JDK 1.1.x
 815  * releases, we keep PeerFixer in both places. Because of the scoping rules,
 816  * the PeerFixer that is used in ScrollPane will be the one that is the
 817  * inner class. This pkg private PeerFixer class below will only be used
 818  * if the Java 2 platform is used to deserialize ScrollPane objects that were serialized
 819  * using JDK1.1
 820  */
 821 class PeerFixer implements AdjustmentListener, java.io.Serializable {
 822     /*
 823      * serialVersionUID
 824      */
 825     private static final long serialVersionUID = 7051237413532574756L;
 826 
 827     PeerFixer(ScrollPane scroller) {
 828         this.scroller = scroller;
 829     }
 830 
 831     /**
 832      * Invoked when the value of the adjustable has changed.
 833      */

 834     public void adjustmentValueChanged(AdjustmentEvent e) {
 835         Adjustable adj = e.getAdjustable();
 836         int value = e.getValue();
 837         ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
 838         if (peer != null) {
 839             peer.setValue(adj, value);
 840         }
 841 
 842         Component c = scroller.getComponent(0);
 843         switch(adj.getOrientation()) {
 844         case Adjustable.VERTICAL:
 845             c.move(c.getLocation().x, -(value));
 846             break;
 847         case Adjustable.HORIZONTAL:
 848             c.move(-(value), c.getLocation().y);
 849             break;
 850         default:
 851             throw new IllegalArgumentException("Illegal adjustable orientation");
 852         }
 853     }


 715 //          // read unrelated objects further down the stream (4352819).
 716 //      }
 717 //      else {
 718 //          // Reading data from 1.4 or later, it's ok to try to read
 719 //          // optional data as OptionalDataException with eof == true
 720 //          // will be correctly reported
 721 //      }
 722     }
 723 
 724     class PeerFixer implements AdjustmentListener, java.io.Serializable
 725     {
 726         private static final long serialVersionUID = 1043664721353696630L;
 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         }


 815  * Instead of moving it back out here, which would break all JDK 1.1.x
 816  * releases, we keep PeerFixer in both places. Because of the scoping rules,
 817  * the PeerFixer that is used in ScrollPane will be the one that is the
 818  * inner class. This pkg private PeerFixer class below will only be used
 819  * if the Java 2 platform is used to deserialize ScrollPane objects that were serialized
 820  * using JDK1.1
 821  */
 822 class PeerFixer implements AdjustmentListener, java.io.Serializable {
 823     /*
 824      * serialVersionUID
 825      */
 826     private static final long serialVersionUID = 7051237413532574756L;
 827 
 828     PeerFixer(ScrollPane scroller) {
 829         this.scroller = scroller;
 830     }
 831 
 832     /**
 833      * Invoked when the value of the adjustable has changed.
 834      */
 835     @SuppressWarnings("deprecation")
 836     public void adjustmentValueChanged(AdjustmentEvent e) {
 837         Adjustable adj = e.getAdjustable();
 838         int value = e.getValue();
 839         ScrollPanePeer peer = (ScrollPanePeer) scroller.peer;
 840         if (peer != null) {
 841             peer.setValue(adj, value);
 842         }
 843 
 844         Component c = scroller.getComponent(0);
 845         switch(adj.getOrientation()) {
 846         case Adjustable.VERTICAL:
 847             c.move(c.getLocation().x, -(value));
 848             break;
 849         case Adjustable.HORIZONTAL:
 850             c.move(-(value), c.getLocation().y);
 851             break;
 852         default:
 853             throw new IllegalArgumentException("Illegal adjustable orientation");
 854         }
 855     }
< prev index next >