Source Code Cross Referenced for NavigationControlPanel.java in  » 6.0-JDK-Modules » java-3d » org » jdesktop » j3dedit » scenegrapheditor » 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 » java 3d » org.jdesktop.j3dedit.scenegrapheditor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegrapheditor/NavigationControlPanel.java,v 1.1 2005/04/20 22:20:47 paulby Exp $
003:         *
004:         *                         Sun Public License Notice
005:         *
006:         *  The contents of this file are subject to the Sun Public License Version
007:         *  1.0 (the "License"). You may not use this file except in compliance with
008:         *  the License. A copy of the License is available at http://www.sun.com/
009:         *  
010:         *  The Original Code is the Java 3D(tm) Scene Graph Editor.
011:         *  The Initial Developer of the Original Code is Paul Byrne.
012:         *  Portions created by Paul Byrne are Copyright (C) 2002.
013:         *  All Rights Reserved.
014:         *  
015:         *  Contributor(s): Paul Byrne.
016:         *  
017:         **/
018:        package org.jdesktop.j3dedit.scenegrapheditor;
019:
020:        import javax.media.j3d.TransformGroup;
021:        import javax.media.j3d.BranchGroup;
022:        import javax.media.j3d.Canvas3D;
023:        import javax.media.j3d.BoundingSphere;
024:        import javax.vecmath.Point3d;
025:        import com.sun.j3d.utils.behaviors.mouse.*;
026:
027:        /**
028:         * @author Paul Byrne
029:         * @version	1.7, 01/18/02
030:         */
031:        public class NavigationControlPanel extends javax.swing.JPanel {
032:
033:            private Canvas3D canvas;
034:            private MouseRotate rotate = new MouseRotate(
035:                    MouseBehavior.MANUAL_WAKEUP);
036:            private MouseTranslate translate = new MouseTranslate(
037:                    MouseBehavior.MANUAL_WAKEUP);
038:            private MouseZoom zoom = new MouseZoom(MouseBehavior.MANUAL_WAKEUP);
039:
040:            /** Creates new form NavigationControlPanel */
041:            public NavigationControlPanel() {
042:                initComponents();
043:                rotateTF.setText(Double.toString(rotate.getXFactor()));
044:                zoomTF.setText(Double.toString(zoom.getFactor()));
045:                translateTF.setText(Double.toString(translate.getXFactor()));
046:            }
047:
048:            public void setTransformGroup(BranchGroup toolRoot,
049:                    TransformGroup tg) {
050:                rotate.setTransformGroup(tg);
051:                rotate.setSchedulingBounds(new BoundingSphere(new Point3d(),
052:                        Double.POSITIVE_INFINITY));
053:                zoom.setTransformGroup(tg);
054:                zoom.setSchedulingBounds(new BoundingSphere(new Point3d(),
055:                        Double.POSITIVE_INFINITY));
056:                translate.setTransformGroup(tg);
057:                translate.setSchedulingBounds(new BoundingSphere(new Point3d(),
058:                        Double.POSITIVE_INFINITY));
059:                NavigationControlVisualTool bg = new NavigationControlVisualTool();
060:                bg.addChild(rotate);
061:                bg.addChild(zoom);
062:                bg.addChild(translate);
063:                toolRoot.addChild(bg);
064:            }
065:
066:            public void setCanvas3D(Canvas3D canvas) {
067:                this .canvas = canvas;
068:            }
069:
070:            /** This method is called from within the constructor to
071:             * initialize the form.
072:             * WARNING: Do NOT modify this code. The content of this method is
073:             * always regenerated by the FormEditor.
074:             */
075:            private void initComponents() {//GEN-BEGIN:initComponents
076:                inputP = new javax.swing.JPanel();
077:                jPanel1 = new javax.swing.JPanel();
078:                jLabel1 = new javax.swing.JLabel();
079:                jLabel2 = new javax.swing.JLabel();
080:                zoomTF = new javax.swing.JTextField();
081:                translateTF = new javax.swing.JTextField();
082:                rotateTF = new javax.swing.JTextField();
083:                jLabel3 = new javax.swing.JLabel();
084:                jPanel2 = new javax.swing.JPanel();
085:                jLabel4 = new javax.swing.JLabel();
086:                jLabel5 = new javax.swing.JLabel();
087:
088:                setLayout(new java.awt.BorderLayout());
089:
090:                inputP
091:                        .setBorder(new javax.swing.border.MatteBorder(
092:                                new java.awt.Insets(1, 1, 1, 1),
093:                                java.awt.Color.orange));
094:                inputP.setToolTipText("");
095:                inputP.setPreferredSize(new java.awt.Dimension(60, 60));
096:                inputP.setMinimumSize(new java.awt.Dimension(60, 60));
097:                inputP.addMouseListener(new java.awt.event.MouseAdapter() {
098:                    public void mousePressed(java.awt.event.MouseEvent evt) {
099:                        inputPMouseEvent(evt);
100:                    }
101:
102:                    public void mouseReleased(java.awt.event.MouseEvent evt) {
103:                        inputPMouseEvent(evt);
104:                        intputPMouseReleased(evt);
105:                    }
106:
107:                    public void mouseClicked(java.awt.event.MouseEvent evt) {
108:                        inputPMouseEvent(evt);
109:                    }
110:                });
111:
112:                inputP
113:                        .addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
114:                            public void mouseMoved(java.awt.event.MouseEvent evt) {
115:                                inputPMouseEvent(evt);
116:                            }
117:
118:                            public void mouseDragged(
119:                                    java.awt.event.MouseEvent evt) {
120:                                inputPMouseEvent(evt);
121:                            }
122:                        });
123:
124:                add(inputP, java.awt.BorderLayout.CENTER);
125:
126:                jPanel1.setLayout(new java.awt.GridBagLayout());
127:                java.awt.GridBagConstraints gridBagConstraints1;
128:
129:                jPanel1.setBorder(new javax.swing.border.EtchedBorder());
130:                jLabel1.setText("Zoom Factor :");
131:                gridBagConstraints1 = new java.awt.GridBagConstraints();
132:                gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 4);
133:                gridBagConstraints1.anchor = java.awt.GridBagConstraints.EAST;
134:                jPanel1.add(jLabel1, gridBagConstraints1);
135:
136:                jLabel2.setText("Translate Factor :");
137:                gridBagConstraints1 = new java.awt.GridBagConstraints();
138:                gridBagConstraints1.gridx = 0;
139:                gridBagConstraints1.gridy = 1;
140:                gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 4);
141:                gridBagConstraints1.anchor = java.awt.GridBagConstraints.EAST;
142:                jPanel1.add(jLabel2, gridBagConstraints1);
143:
144:                zoomTF
145:                        .setDocument(new org.jdesktop.j3dfly.utils.gui.FloatDocument());
146:                zoomTF.setMinimumSize(new java.awt.Dimension(57, 21));
147:                gridBagConstraints1 = new java.awt.GridBagConstraints();
148:                jPanel1.add(zoomTF, gridBagConstraints1);
149:
150:                translateTF
151:                        .setDocument(new org.jdesktop.j3dfly.utils.gui.FloatDocument());
152:                translateTF.setMinimumSize(new java.awt.Dimension(57, 21));
153:                gridBagConstraints1 = new java.awt.GridBagConstraints();
154:                gridBagConstraints1.gridx = 1;
155:                gridBagConstraints1.gridy = 1;
156:                jPanel1.add(translateTF, gridBagConstraints1);
157:
158:                rotateTF
159:                        .setDocument(new org.jdesktop.j3dfly.utils.gui.FloatDocument());
160:                rotateTF.setMinimumSize(new java.awt.Dimension(57, 21));
161:                gridBagConstraints1 = new java.awt.GridBagConstraints();
162:                gridBagConstraints1.gridx = 1;
163:                gridBagConstraints1.gridy = 2;
164:                jPanel1.add(rotateTF, gridBagConstraints1);
165:
166:                jLabel3.setText("Rotate Factor :");
167:                gridBagConstraints1 = new java.awt.GridBagConstraints();
168:                gridBagConstraints1.gridx = 0;
169:                gridBagConstraints1.gridy = 2;
170:                gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 4);
171:                gridBagConstraints1.anchor = java.awt.GridBagConstraints.EAST;
172:                jPanel1.add(jLabel3, gridBagConstraints1);
173:
174:                add(jPanel1, java.awt.BorderLayout.NORTH);
175:
176:                jPanel2.setLayout(new java.awt.BorderLayout());
177:
178:                jLabel4
179:                        .setText("Move the mouse in the Yellow Area to change the View");
180:                jPanel2.add(jLabel4, java.awt.BorderLayout.NORTH);
181:
182:                jLabel5.setText("Mouse Buttons : Rotate, Zoom, Translate");
183:                jPanel2.add(jLabel5, java.awt.BorderLayout.SOUTH);
184:
185:                add(jPanel2, java.awt.BorderLayout.SOUTH);
186:
187:            }//GEN-END:initComponents
188:
189:            private void intputPMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_intputPMouseReleased
190:            // Add your handling code here:
191:                canvas.dispatchEvent(evt);
192:            }//GEN-LAST:event_intputPMouseReleased
193:
194:            private void inputPMouseEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_inputPMouseEvent
195:            // Add your handling code here
196:                rotate.wakeup();
197:                zoom.wakeup();
198:                translate.wakeup();
199:
200:                canvas.dispatchEvent(evt);
201:            }//GEN-LAST:event_inputPMouseEvent
202:
203:            private void closeBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeBActionPerformed
204:            // Add your handling code here:
205:            }//GEN-LAST:event_closeBActionPerformed
206:
207:            // Variables declaration - do not modify//GEN-BEGIN:variables
208:            private javax.swing.JPanel inputP;
209:            private javax.swing.JPanel jPanel1;
210:            private javax.swing.JLabel jLabel1;
211:            private javax.swing.JLabel jLabel2;
212:            private javax.swing.JTextField zoomTF;
213:            private javax.swing.JTextField translateTF;
214:            private javax.swing.JTextField rotateTF;
215:            private javax.swing.JLabel jLabel3;
216:            private javax.swing.JPanel jPanel2;
217:            private javax.swing.JLabel jLabel4;
218:            private javax.swing.JLabel jLabel5;
219:            // End of variables declaration//GEN-END:variables
220:
221:        }
222:
223:        class NavigationControlVisualTool extends
224:                org.jdesktop.j3dedit.scenegrapheditor.visualtools.VisualTool {
225:
226:            public void reset() {
227:            }
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.