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


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dFly/src/org/jdesktop/j3dfly/plugins/ViewControlPanel.java,v 1.1 2005/04/20 21:04: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 Java 3D(tm) Fly Through.
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.j3dfly.plugins;
019:
020:        import javax.media.j3d.View;
021:        import org.jdesktop.j3dfly.utils.gui.ErrorManager;
022:
023:        /**
024:         *
025:         * @author  Paul Byrne
026:         * @version $Revision: 1.1 $
027:         */
028:        public class ViewControlPanel extends javax.swing.JPanel {
029:
030:            private ViewControlPlugin plugin;
031:
032:            /** Creates new form ViewControlPanel */
033:            public ViewControlPanel(ViewControlPlugin plugin) {
034:                super ();
035:                this .plugin = plugin;
036:                initComponents();
037:
038:                View view = plugin.getJ3dFlyContext().getUniverse().getViewer()
039:                        .getView();
040:                antialiasCB.setSelected(view.getSceneAntialiasingEnable());
041:                if (view.getTransparencySortingPolicy() == View.TRANSPARENCY_SORT_NONE)
042:                    transparencySortingCB.setSelected(false);
043:                else
044:                    transparencySortingCB.setSelected(true);
045:
046:                frontClipTF.setText(Double
047:                        .toString(view.getFrontClipDistance()));
048:                backClipTF.setText(Double.toString(view.getBackClipDistance()));
049:
050:                if (view.getWindowResizePolicy() == View.VIRTUAL_WORLD)
051:                    resizePolicyCB.setSelectedIndex(0);
052:                else
053:                    resizePolicyCB.setSelectedIndex(1);
054:            }
055:
056:            /** This method is called from within the constructor to
057:             * initialize the form.
058:             * WARNING: Do NOT modify this code. The content of this method is
059:             * always regenerated by the Form Editor.
060:             */
061:            private void initComponents() {//GEN-BEGIN:initComponents
062:                java.awt.GridBagConstraints gridBagConstraints;
063:
064:                antialiasCB = new javax.swing.JCheckBox();
065:                transparencySortingCB = new javax.swing.JCheckBox();
066:                frontClipL = new javax.swing.JLabel();
067:                backClipL = new javax.swing.JLabel();
068:                frontClipTF = new javax.swing.JTextField();
069:                backClipTF = new javax.swing.JTextField();
070:                resizePolicyL = new javax.swing.JLabel();
071:                resizePolicyCB = new javax.swing.JComboBox(new String[] {
072:                        "VIRTUAL_WORLD", "PHYSICAL_WORLD" });
073:                cycleTimeL = new javax.swing.JLabel();
074:                jPanel1 = new javax.swing.JPanel();
075:                cycleTimeMsTF = new javax.swing.JTextField();
076:                jLabel2 = new javax.swing.JLabel();
077:                jPanel2 = new javax.swing.JPanel();
078:                cycleTimeHzTF = new javax.swing.JTextField();
079:                jLabel3 = new javax.swing.JLabel();
080:
081:                setLayout(new java.awt.GridBagLayout());
082:
083:                antialiasCB.setText("Antialias Scene");
084:                antialiasCB
085:                        .setToolTipText("Enable/Disable Antialiasing on the Scene");
086:                antialiasCB
087:                        .addActionListener(new java.awt.event.ActionListener() {
088:                            public void actionPerformed(
089:                                    java.awt.event.ActionEvent evt) {
090:                                antialiasCBActionPerformed(evt);
091:                            }
092:                        });
093:
094:                gridBagConstraints = new java.awt.GridBagConstraints();
095:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
096:                add(antialiasCB, gridBagConstraints);
097:
098:                transparencySortingCB.setText("Sort Transparent Geometry");
099:                transparencySortingCB
100:                        .setToolTipText("Enable/Disable Transparency sorting");
101:                transparencySortingCB
102:                        .addActionListener(new java.awt.event.ActionListener() {
103:                            public void actionPerformed(
104:                                    java.awt.event.ActionEvent evt) {
105:                                transparencySortingCBActionPerformed(evt);
106:                            }
107:                        });
108:
109:                gridBagConstraints = new java.awt.GridBagConstraints();
110:                gridBagConstraints.gridx = 0;
111:                gridBagConstraints.gridy = 1;
112:                gridBagConstraints.gridwidth = 2;
113:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
114:                add(transparencySortingCB, gridBagConstraints);
115:
116:                frontClipL.setText("Front Clip Distance");
117:                gridBagConstraints = new java.awt.GridBagConstraints();
118:                gridBagConstraints.gridx = 0;
119:                gridBagConstraints.gridy = 2;
120:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
121:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
122:                add(frontClipL, gridBagConstraints);
123:
124:                backClipL.setText("Back Clip Distance");
125:                gridBagConstraints = new java.awt.GridBagConstraints();
126:                gridBagConstraints.gridx = 0;
127:                gridBagConstraints.gridy = 3;
128:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
129:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
130:                add(backClipL, gridBagConstraints);
131:
132:                frontClipTF.setColumns(8);
133:                frontClipTF
134:                        .setDocument(new org.jdesktop.j3dfly.utils.gui.DoubleDocument());
135:                frontClipTF
136:                        .addActionListener(new java.awt.event.ActionListener() {
137:                            public void actionPerformed(
138:                                    java.awt.event.ActionEvent evt) {
139:                                frontClipTFActionPerformed(evt);
140:                            }
141:                        });
142:
143:                gridBagConstraints = new java.awt.GridBagConstraints();
144:                gridBagConstraints.gridx = 1;
145:                gridBagConstraints.gridy = 2;
146:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
147:                add(frontClipTF, gridBagConstraints);
148:
149:                backClipTF.setColumns(8);
150:                backClipTF
151:                        .setDocument(new org.jdesktop.j3dfly.utils.gui.DoubleDocument());
152:                backClipTF
153:                        .addActionListener(new java.awt.event.ActionListener() {
154:                            public void actionPerformed(
155:                                    java.awt.event.ActionEvent evt) {
156:                                backClipTFActionPerformed(evt);
157:                            }
158:                        });
159:
160:                gridBagConstraints = new java.awt.GridBagConstraints();
161:                gridBagConstraints.gridx = 1;
162:                gridBagConstraints.gridy = 3;
163:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
164:                add(backClipTF, gridBagConstraints);
165:
166:                resizePolicyL.setText("Window Resize Policy");
167:                gridBagConstraints = new java.awt.GridBagConstraints();
168:                gridBagConstraints.gridx = 0;
169:                gridBagConstraints.gridy = 4;
170:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
171:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
172:                add(resizePolicyL, gridBagConstraints);
173:
174:                resizePolicyCB
175:                        .addActionListener(new java.awt.event.ActionListener() {
176:                            public void actionPerformed(
177:                                    java.awt.event.ActionEvent evt) {
178:                                resizePolicyCBActionPerformed(evt);
179:                            }
180:                        });
181:
182:                gridBagConstraints = new java.awt.GridBagConstraints();
183:                gridBagConstraints.gridx = 1;
184:                gridBagConstraints.gridy = 4;
185:                add(resizePolicyCB, gridBagConstraints);
186:
187:                cycleTimeL.setText("Min Frame Cycle Time");
188:                cycleTimeL.setToolTipText("Minium Frame Cycle Time");
189:                gridBagConstraints = new java.awt.GridBagConstraints();
190:                gridBagConstraints.gridx = 0;
191:                gridBagConstraints.gridy = 5;
192:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
193:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
194:                add(cycleTimeL, gridBagConstraints);
195:
196:                cycleTimeMsTF.setColumns(5);
197:                cycleTimeMsTF
198:                        .setDocument(new org.jdesktop.j3dfly.utils.gui.LongDocument());
199:                cycleTimeMsTF.setText("0");
200:                cycleTimeMsTF
201:                        .addActionListener(new java.awt.event.ActionListener() {
202:                            public void actionPerformed(
203:                                    java.awt.event.ActionEvent evt) {
204:                                cycleTimeMsTFActionPerformed(evt);
205:                            }
206:                        });
207:
208:                jPanel1.add(cycleTimeMsTF);
209:
210:                jLabel2.setText("ms.");
211:                jPanel1.add(jLabel2);
212:
213:                gridBagConstraints = new java.awt.GridBagConstraints();
214:                gridBagConstraints.gridx = 1;
215:                gridBagConstraints.gridy = 6;
216:                add(jPanel1, gridBagConstraints);
217:
218:                cycleTimeHzTF.setColumns(5);
219:                cycleTimeHzTF
220:                        .setDocument(new org.jdesktop.j3dfly.utils.gui.DoubleDocument());
221:                cycleTimeHzTF
222:                        .setHorizontalAlignment(javax.swing.JTextField.TRAILING);
223:                cycleTimeHzTF
224:                        .addActionListener(new java.awt.event.ActionListener() {
225:                            public void actionPerformed(
226:                                    java.awt.event.ActionEvent evt) {
227:                                cycleTimeHzTFActionPerformed(evt);
228:                            }
229:                        });
230:
231:                jPanel2.add(cycleTimeHzTF);
232:
233:                jLabel3.setText("Hz.");
234:                jPanel2.add(jLabel3);
235:
236:                gridBagConstraints = new java.awt.GridBagConstraints();
237:                gridBagConstraints.gridx = 1;
238:                gridBagConstraints.gridy = 5;
239:                add(jPanel2, gridBagConstraints);
240:
241:            }//GEN-END:initComponents
242:
243:            private void backClipTFActionPerformed(
244:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backClipTFActionPerformed
245:                // Add your handling code here:
246:                plugin.setBackClipDistance(Double.parseDouble(backClipTF
247:                        .getText()));
248:            }//GEN-LAST:event_backClipTFActionPerformed
249:
250:            private void frontClipTFActionPerformed(
251:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_frontClipTFActionPerformed
252:                // Add your handling code here:
253:                plugin.setFrontClipDistance(Double.parseDouble(frontClipTF
254:                        .getText()));
255:            }//GEN-LAST:event_frontClipTFActionPerformed
256:
257:            private void cycleTimeMsTFActionPerformed(
258:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cycleTimeMsTFActionPerformed
259:                // Add your handling code here:
260:                long ms = 0;
261:
262:                if (cycleTimeMsTF.getText() != null)
263:                    try {
264:                        ms = Long.parseLong(cycleTimeMsTF.getText());
265:                    } catch (NumberFormatException e) {
266:                        ms = 0;
267:                    }
268:
269:                if (ms == 0) {
270:                    try {
271:                        cycleTimeHzTF.setText(null);
272:                    } catch (NullPointerException e) {
273:                    }
274:                } else {
275:                    double hz = 1.0 / ms * 1000;
276:                    cycleTimeHzTF.setText(Double.toString(hz));
277:                }
278:                plugin.setMinimumFrameCylcleTime(ms);
279:            }//GEN-LAST:event_cycleTimeMsTFActionPerformed
280:
281:            private void cycleTimeHzTFActionPerformed(
282:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cycleTimeHzTFActionPerformed
283:                // Add your handling code here:
284:                double hz = 0;
285:
286:                if (cycleTimeHzTF.getText() != null)
287:                    try {
288:                        hz = Double.parseDouble(cycleTimeHzTF.getText());
289:                    } catch (NumberFormatException e) {
290:                        hz = 0;
291:                    }
292:
293:                if (hz == 0) {
294:                    try {
295:                        cycleTimeMsTF.setText(Long.toString(0));
296:                        plugin.setMinimumFrameCylcleTime(0);
297:                        cycleTimeHzTF.setText(null);
298:                    } catch (NullPointerException e) {
299:                    }
300:                } else {
301:                    long ms = (long) ((1.0 / hz) * 1000);
302:
303:                    hz = (1.0 / ms * 1000); // Set Hz to nearest ms.
304:
305:                    cycleTimeMsTF.setText(Long.toString(ms));
306:                    cycleTimeHzTF.setText(Double.toString(hz));
307:                    plugin.setMinimumFrameCylcleTime(ms);
308:                }
309:            }//GEN-LAST:event_cycleTimeHzTFActionPerformed
310:
311:            private void resizePolicyCBActionPerformed(
312:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resizePolicyCBActionPerformed
313:                // Add your handling code here:
314:                if (resizePolicyCB.getSelectedIndex() == 0)
315:                    plugin.setWindowResizePolicy(View.VIRTUAL_WORLD);
316:                else if (resizePolicyCB.getSelectedIndex() == 1)
317:                    plugin.setWindowResizePolicy(View.PHYSICAL_WORLD);
318:                else
319:                    ErrorManager.getDefault().getErrorHandler().notify(
320:                            new RuntimeException("Unknown Resize Policy"));
321:            }//GEN-LAST:event_resizePolicyCBActionPerformed
322:
323:            private void transparencySortingCBActionPerformed(
324:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_transparencySortingCBActionPerformed
325:                // Add your handling code here:
326:                plugin.setTransparencySortingEnabled(transparencySortingCB
327:                        .isSelected());
328:            }//GEN-LAST:event_transparencySortingCBActionPerformed
329:
330:            private void antialiasCBActionPerformed(
331:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_antialiasCBActionPerformed
332:                // Add your handling code here:
333:                plugin.setSceneAntialiasingEnabled(antialiasCB.isSelected());
334:            }//GEN-LAST:event_antialiasCBActionPerformed
335:
336:            // Variables declaration - do not modify//GEN-BEGIN:variables
337:            private javax.swing.JPanel jPanel2;
338:            private javax.swing.JTextField cycleTimeHzTF;
339:            private javax.swing.JPanel jPanel1;
340:            private javax.swing.JCheckBox transparencySortingCB;
341:            private javax.swing.JComboBox resizePolicyCB;
342:            private javax.swing.JLabel cycleTimeL;
343:            private javax.swing.JLabel backClipL;
344:            private javax.swing.JLabel frontClipL;
345:            private javax.swing.JCheckBox antialiasCB;
346:            private javax.swing.JTextField cycleTimeMsTF;
347:            private javax.swing.JTextField frontClipTF;
348:            private javax.swing.JLabel jLabel3;
349:            private javax.swing.JTextField backClipTF;
350:            private javax.swing.JLabel jLabel2;
351:            private javax.swing.JLabel resizePolicyL;
352:            // End of variables declaration//GEN-END:variables
353:
354:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.