src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java

Print this page




  61     @Override
  62     void initialize() {
  63         super.initialize();
  64         setInsets();
  65         Insets i = getInsets();
  66         setScrollPosition(-i.left,-i.top);
  67     }
  68 
  69     @Override
  70     public void setUnitIncrement(Adjustable adj, int p) {
  71         // The unitIncrement is grabbed from the target as needed.
  72     }
  73 
  74     @Override
  75     public Insets insets() {
  76         return getInsets();
  77     }
  78     private native void setInsets();
  79 
  80     @Override
  81     public native synchronized void setScrollPosition(int x, int y);
  82 
  83     @Override
  84     public int getHScrollbarHeight() {
  85         return scrollbarHeight;
  86     }
  87     private native int _getHScrollbarHeight();
  88 
  89     @Override
  90     public int getVScrollbarWidth() {
  91         return scrollbarWidth;
  92     }
  93     private native int _getVScrollbarWidth();
  94 
  95     public Point getScrollOffset() {
  96         int x = getOffset(Adjustable.HORIZONTAL);
  97         int y = getOffset(Adjustable.VERTICAL);
  98         return new Point(x, y);
  99     }
 100 
 101     /**
 102      * The child component has been resized.  The scrollbars must be
 103      * updated with the new sizes.  At the native level the sizes of
 104      * the actual windows may not have changed yet, so the size
 105      * information from the java-level is passed down and used.
 106      */
 107     @Override
 108     public void childResized(int width, int height) {
 109         ScrollPane sp = (ScrollPane)target;
 110         Dimension vs = sp.getSize();
 111         setSpans(vs.width, vs.height, width, height);
 112         setInsets();
 113     }
 114 
 115     native synchronized void setSpans(int viewWidth, int viewHeight,
 116                                       int childWidth, int childHeight);
 117 
 118     /**
 119      * Called by ScrollPane's internal observer of the scrollpane's adjustables.
 120      * This is called whenever a scroll position is changed in one
 121      * of adjustables, whether it was modified externally or from the
 122      * native scrollbars themselves.
 123      */
 124     @Override
 125     public void setValue(Adjustable adj, int v) {
 126         Component c = getScrollChild();
 127         if (c == null) {
 128             return;
 129         }
 130 
 131         Point p = c.getLocation();
 132         switch(adj.getOrientation()) {
 133         case Adjustable.VERTICAL:
 134             setScrollPosition(-(p.x), v);
 135             break;




  61     @Override
  62     void initialize() {
  63         super.initialize();
  64         setInsets();
  65         Insets i = getInsets();
  66         setScrollPosition(-i.left,-i.top);
  67     }
  68 
  69     @Override
  70     public void setUnitIncrement(Adjustable adj, int p) {
  71         // The unitIncrement is grabbed from the target as needed.
  72     }
  73 
  74     @Override
  75     public Insets insets() {
  76         return getInsets();
  77     }
  78     private native void setInsets();
  79 
  80     @Override
  81     public synchronized native void setScrollPosition(int x, int y);
  82 
  83     @Override
  84     public int getHScrollbarHeight() {
  85         return scrollbarHeight;
  86     }
  87     private native int _getHScrollbarHeight();
  88 
  89     @Override
  90     public int getVScrollbarWidth() {
  91         return scrollbarWidth;
  92     }
  93     private native int _getVScrollbarWidth();
  94 
  95     public Point getScrollOffset() {
  96         int x = getOffset(Adjustable.HORIZONTAL);
  97         int y = getOffset(Adjustable.VERTICAL);
  98         return new Point(x, y);
  99     }
 100 
 101     /**
 102      * The child component has been resized.  The scrollbars must be
 103      * updated with the new sizes.  At the native level the sizes of
 104      * the actual windows may not have changed yet, so the size
 105      * information from the java-level is passed down and used.
 106      */
 107     @Override
 108     public void childResized(int width, int height) {
 109         ScrollPane sp = (ScrollPane)target;
 110         Dimension vs = sp.getSize();
 111         setSpans(vs.width, vs.height, width, height);
 112         setInsets();
 113     }
 114 
 115     synchronized native void setSpans(int viewWidth, int viewHeight,
 116                                       int childWidth, int childHeight);
 117 
 118     /**
 119      * Called by ScrollPane's internal observer of the scrollpane's adjustables.
 120      * This is called whenever a scroll position is changed in one
 121      * of adjustables, whether it was modified externally or from the
 122      * native scrollbars themselves.
 123      */
 124     @Override
 125     public void setValue(Adjustable adj, int v) {
 126         Component c = getScrollChild();
 127         if (c == null) {
 128             return;
 129         }
 130 
 131         Point p = c.getLocation();
 132         switch(adj.getOrientation()) {
 133         case Adjustable.VERTICAL:
 134             setScrollPosition(-(p.x), v);
 135             break;