Source Code Cross Referenced for PPCScrollPanePeer.java in  » 6.0-JDK-Modules » j2me » sun » awt » pocketpc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » sun.awt.pocketpc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)PPCScrollPanePeer.java	1.10 06/10/10 
003:         *
004:         * Copyright  1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation. 
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt). 
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA 
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions. 
025:         */
026:
027:        package sun.awt.pocketpc;
028:
029:        import java.awt.*;
030:        import java.awt.event.AdjustmentEvent;
031:        import sun.awt.peer.*;
032:
033:        /**
034:         *
035:         *
036:         * @author Nicholas Allen
037:         */
038:
039:        class PPCScrollPanePeer extends PPCPanelPeer implements  ScrollPanePeer {
040:            private static native void initIDs();
041:
042:            static {
043:                initIDs();
044:            }
045:
046:            int scrollbarWidth;
047:            int scrollbarHeight;
048:            boolean ignore;
049:
050:            native void create(PPCComponentPeer parent);
051:
052:            native int getOffset(int orient);
053:
054:            PPCScrollPanePeer(Component target) {
055:                super (target);
056:                scrollbarWidth = getVScrollbarWidthNative();
057:                scrollbarHeight = getHScrollbarHeightNative();
058:                ignore = false;
059:            }
060:
061:            void initialize() {
062:                super .initialize();
063:                setInsets();
064:            }
065:
066:            public void setUnitIncrement(Adjustable adj, int p) {
067:                // The unitIncrement is grabbed from the target as needed.
068:            }
069:
070:            public Insets insets() {
071:                return getInsets();
072:            }
073:
074:            private native void setInsets();
075:
076:            public native synchronized void setScrollPosition(int x, int y);
077:
078:            public int getHScrollbarHeight() {
079:                return scrollbarHeight;
080:            }
081:
082:            private native int getHScrollbarHeightNative();
083:
084:            public int getVScrollbarWidth() {
085:                return scrollbarWidth;
086:            }
087:
088:            private native int getVScrollbarWidthNative();
089:
090:            public Point getScrollOffset() {
091:                int x, y;
092:                x = getOffset(Scrollbar.HORIZONTAL);
093:                y = getOffset(Scrollbar.VERTICAL);
094:                return new Point(x, y);
095:            }
096:
097:            /**
098:             * The child component has been resized.  The scrollbars must be
099:             * updated with the new sizes.  At the native level the sizes of
100:             * the actual windows may not have changed yet, so the size
101:             * information from the java-level is passed down and used.
102:             */
103:            public void childResized(int width, int height) {
104:                ScrollPane sp = (ScrollPane) target;
105:                Dimension vs = sp.getSize();
106:                setSpans(vs.width, vs.height, width, height);
107:                setInsets();
108:            }
109:
110:            native synchronized void setSpans(int viewWidth, int viewHeight,
111:                    int childWidth, int childHeight);
112:
113:            /**
114:             * Called by ScrollPane's internal observer of the scrollpane's adjustables.
115:             * This is called whenever a scroll position is changed in one
116:             * of adjustables, whether it was modified externally or from the
117:             * native scrollbars themselves.  If the change was sourced by the
118:             * native scrollbars then ignore will be set to true.
119:             */
120:            public void setValue(Adjustable adj, int v) {
121:                if (!ignore) {
122:                    Component c = getScrollChild();
123:                    Point p = c.getLocation();
124:                    switch (adj.getOrientation()) {
125:                    case Adjustable.VERTICAL:
126:                        setScrollPosition(-(p.x), v);
127:                        break;
128:                    case Adjustable.HORIZONTAL:
129:                        setScrollPosition(v, -(p.y));
130:                        break;
131:                    }
132:                }
133:            }
134:
135:            private native Component getScrollChild();
136:
137:            /**
138:             * Callback from windows to indicate that the vertical scrollbar was
139:             * adjusted and a new value is desired.  If this is a valid
140:             * value the adjustable will change and setValue will be called.
141:             */
142:            void scrolledVertical(int value) {
143:                ScrollPane sp = (ScrollPane) target;
144:                Adjustable adj = sp.getVAdjustable();
145:                if (adj != null) {
146:                    Adjustor e = new Adjustor(adj, value, this );
147:                    PPCToolkit.postEvent(e);
148:                }
149:            }
150:
151:            /**
152:             * Callback from windows to indicate that the horizontal scrollbar was
153:             * adjusted and a new value is desired.  If this is a valid
154:             * value the adjustable will change and setValue will be called.
155:             */
156:            void scrolledHorizontal(int value) {
157:                ScrollPane sp = (ScrollPane) target;
158:                Adjustable adj = sp.getHAdjustable();
159:                if (adj != null) {
160:                    Adjustor e = new Adjustor(adj, value, this );
161:                    PPCToolkit.postEvent(e);
162:                }
163:            }
164:
165:            /**
166:             * This is used to change the adjustable on another thread 
167:             * to represent a change made in the native scrollbar.  Since
168:             * the change was reflected immediately at the native level,
169:             * notification from the adjustable is temporarily ignored.
170:             */
171:            class Adjustor extends AWTEvent implements  java.awt.ActiveEvent {
172:
173:                Adjustor(Adjustable adj, int value, PPCScrollPanePeer peer) {
174:                    super (adj, 0);
175:                    this .adj = adj;
176:                    this .value = value;
177:                    this .peer = peer;
178:                }
179:
180:                public void dispatch() {
181:                    peer.ignore = true;
182:                    adj.setValue(value);
183:                    peer.ignore = false;
184:                }
185:
186:                int value;
187:                Adjustable adj;
188:                PPCScrollPanePeer peer;
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.