< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  54 
  55     WScrollPanePeer(Component target) {
  56         super(target);
  57         scrollbarWidth = _getVScrollbarWidth();
  58         scrollbarHeight = _getHScrollbarHeight();
  59     }
  60 
  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);


   1 /*
   2  * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  54 
  55     WScrollPanePeer(Component target) {
  56         super(target);
  57         scrollbarWidth = _getVScrollbarWidth();
  58         scrollbarHeight = _getHScrollbarHeight();
  59     }
  60 
  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     private native void setInsets();
  75 
  76     @Override
  77     public synchronized native void setScrollPosition(int x, int y);
  78 
  79     @Override
  80     public int getHScrollbarHeight() {
  81         return scrollbarHeight;
  82     }
  83     private native int _getHScrollbarHeight();
  84 
  85     @Override
  86     public int getVScrollbarWidth() {
  87         return scrollbarWidth;
  88     }
  89     private native int _getVScrollbarWidth();
  90 
  91     public Point getScrollOffset() {
  92         int x = getOffset(Adjustable.HORIZONTAL);
  93         int y = getOffset(Adjustable.VERTICAL);


< prev index next >