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


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegrapheditor/nodeeditors/panels/AlphaPanel.java,v 1.1 2005/04/20 22:21:02 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.nodeeditors.panels;
019:
020:        import java.awt.Frame;
021:        import javax.media.j3d.*;
022:        import org.jdesktop.j3dfly.utils.gui.LongDocument;
023:        import org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.NodeComponentEditorPanel;
024:        import org.jdesktop.j3dfly.utils.gui.ErrorManager;
025:
026:        /**
027:         * @author Paul Byrne
028:         * @version	1.5, 01/18/02
029:         */
030:        public class AlphaPanel extends NodeComponentEditorPanel implements 
031:                javax.swing.event.DocumentListener {
032:
033:            private long alphaAtZero;
034:            private long alphaAtOne;
035:            private long alphaIncreasing;
036:            private long alphaDecreasing;
037:
038:            private AlphaChangeListener changeListener = null;
039:
040:            private boolean tfChanged = false;
041:
042:            public AlphaPanel() {
043:                super ();
044:                initComponents();
045:
046:                zeroTF.getDocument().addDocumentListener(this );
047:                oneTF.getDocument().addDocumentListener(this );
048:                increasingTF.getDocument().addDocumentListener(this );
049:                decreasingTF.getDocument().addDocumentListener(this );
050:            }
051:
052:            public void setAlphaChangeListener(AlphaChangeListener listener) {
053:                changeListener = listener;
054:            }
055:
056:            public void setReadOnly(boolean readOnly) {
057:                this .readOnly = readOnly;
058:                zeroTF.setEnabled(!readOnly);
059:                oneTF.setEnabled(!readOnly);
060:                increasingTF.setEnabled(!readOnly);
061:                decreasingTF.setEnabled(!readOnly);
062:            }
063:
064:            /** This method is called from within the constructor to
065:             * initialize the form.
066:             * WARNING: Do NOT modify this code. The content of this method is
067:             * always regenerated by the FormEditor.
068:             */
069:            private void initComponents() {//GEN-BEGIN:initComponents
070:                java.awt.GridBagConstraints gridBagConstraints;
071:
072:                ncCommonP = new org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.panels.CommonNodeComponentPanel();
073:                jPanel1 = new javax.swing.JPanel();
074:                jPanel3 = new javax.swing.JPanel();
075:                decreasingTF = new javax.swing.JTextField();
076:                zeroL = new javax.swing.JLabel();
077:                increaseL = new javax.swing.JLabel();
078:                oneL = new javax.swing.JLabel();
079:                decreaseL = new javax.swing.JLabel();
080:                zeroTF = new javax.swing.JTextField();
081:                increasingTF = new javax.swing.JTextField();
082:                oneTF = new javax.swing.JTextField();
083:                jLabel1 = new javax.swing.JLabel();
084:                jLabel2 = new javax.swing.JLabel();
085:                jLabel3 = new javax.swing.JLabel();
086:                jLabel4 = new javax.swing.JLabel();
087:
088:                setLayout(new java.awt.BorderLayout());
089:
090:                add(ncCommonP, java.awt.BorderLayout.NORTH);
091:
092:                jPanel3.setLayout(new java.awt.GridBagLayout());
093:
094:                decreasingTF.setColumns(6);
095:                decreasingTF.setDocument(new LongDocument());
096:                decreasingTF.setText("0");
097:                decreasingTF
098:                        .addFocusListener(new java.awt.event.FocusAdapter() {
099:                            public void focusGained(
100:                                    java.awt.event.FocusEvent evt) {
101:                                TFFocusGained(evt);
102:                            }
103:
104:                            public void focusLost(java.awt.event.FocusEvent evt) {
105:                                decreasingTFFocusLost(evt);
106:                            }
107:                        });
108:
109:                gridBagConstraints = new java.awt.GridBagConstraints();
110:                gridBagConstraints.gridx = 1;
111:                gridBagConstraints.gridy = 3;
112:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
113:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
114:                jPanel3.add(decreasingTF, gridBagConstraints);
115:
116:                zeroL.setText("Alpha At Zero Duration");
117:                gridBagConstraints = new java.awt.GridBagConstraints();
118:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
119:                jPanel3.add(zeroL, gridBagConstraints);
120:
121:                increaseL.setText("Alpha Increasing Duration");
122:                gridBagConstraints = new java.awt.GridBagConstraints();
123:                gridBagConstraints.gridx = 0;
124:                gridBagConstraints.gridy = 1;
125:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
126:                jPanel3.add(increaseL, gridBagConstraints);
127:
128:                oneL.setText("Alpha At One Duration");
129:                gridBagConstraints = new java.awt.GridBagConstraints();
130:                gridBagConstraints.gridx = 0;
131:                gridBagConstraints.gridy = 2;
132:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
133:                jPanel3.add(oneL, gridBagConstraints);
134:
135:                decreaseL.setText("Alpha Decreasing Duration");
136:                gridBagConstraints = new java.awt.GridBagConstraints();
137:                gridBagConstraints.gridx = 0;
138:                gridBagConstraints.gridy = 3;
139:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
140:                jPanel3.add(decreaseL, gridBagConstraints);
141:
142:                zeroTF.setDocument(new LongDocument());
143:                zeroTF.setText("0");
144:                zeroTF.setMinimumSize(new java.awt.Dimension(57, 21));
145:                zeroTF.addFocusListener(new java.awt.event.FocusAdapter() {
146:                    public void focusGained(java.awt.event.FocusEvent evt) {
147:                        TFFocusGained(evt);
148:                    }
149:
150:                    public void focusLost(java.awt.event.FocusEvent evt) {
151:                        zeroTFFocusLost(evt);
152:                    }
153:                });
154:
155:                gridBagConstraints = new java.awt.GridBagConstraints();
156:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
157:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
158:                jPanel3.add(zeroTF, gridBagConstraints);
159:
160:                increasingTF.setColumns(6);
161:                increasingTF.setDocument(new LongDocument());
162:                increasingTF.setText("0");
163:                increasingTF
164:                        .addActionListener(new java.awt.event.ActionListener() {
165:                            public void actionPerformed(
166:                                    java.awt.event.ActionEvent evt) {
167:                                increasingTFActionPerformed(evt);
168:                            }
169:                        });
170:
171:                increasingTF
172:                        .addFocusListener(new java.awt.event.FocusAdapter() {
173:                            public void focusGained(
174:                                    java.awt.event.FocusEvent evt) {
175:                                TFFocusGained(evt);
176:                            }
177:
178:                            public void focusLost(java.awt.event.FocusEvent evt) {
179:                                increasingTFFocusLost(evt);
180:                            }
181:                        });
182:
183:                gridBagConstraints = new java.awt.GridBagConstraints();
184:                gridBagConstraints.gridx = 1;
185:                gridBagConstraints.gridy = 1;
186:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
187:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
188:                jPanel3.add(increasingTF, gridBagConstraints);
189:
190:                oneTF.setColumns(6);
191:                oneTF.setDocument(new LongDocument());
192:                oneTF.setText("0");
193:                oneTF.addFocusListener(new java.awt.event.FocusAdapter() {
194:                    public void focusGained(java.awt.event.FocusEvent evt) {
195:                        TFFocusGained(evt);
196:                    }
197:
198:                    public void focusLost(java.awt.event.FocusEvent evt) {
199:                        oneTFFocusLost(evt);
200:                    }
201:                });
202:
203:                gridBagConstraints = new java.awt.GridBagConstraints();
204:                gridBagConstraints.gridx = 1;
205:                gridBagConstraints.gridy = 2;
206:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
207:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
208:                jPanel3.add(oneTF, gridBagConstraints);
209:
210:                jLabel1.setText("ms.");
211:                gridBagConstraints = new java.awt.GridBagConstraints();
212:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
213:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
214:                jPanel3.add(jLabel1, gridBagConstraints);
215:
216:                jLabel2.setText("ms.");
217:                gridBagConstraints = new java.awt.GridBagConstraints();
218:                gridBagConstraints.gridx = 2;
219:                gridBagConstraints.gridy = 1;
220:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
221:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
222:                jPanel3.add(jLabel2, gridBagConstraints);
223:
224:                jLabel3.setText("ms.");
225:                gridBagConstraints = new java.awt.GridBagConstraints();
226:                gridBagConstraints.gridx = 2;
227:                gridBagConstraints.gridy = 2;
228:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
229:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
230:                jPanel3.add(jLabel3, gridBagConstraints);
231:
232:                jLabel4.setText("ms.");
233:                gridBagConstraints = new java.awt.GridBagConstraints();
234:                gridBagConstraints.gridx = 2;
235:                gridBagConstraints.gridy = 3;
236:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
237:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
238:                jPanel3.add(jLabel4, gridBagConstraints);
239:
240:                jPanel1.add(jPanel3);
241:
242:                add(jPanel1, java.awt.BorderLayout.CENTER);
243:
244:            }//GEN-END:initComponents
245:
246:            private void increasingTFActionPerformed(
247:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_increasingTFActionPerformed
248:            // Add your handling code here:
249:            }//GEN-LAST:event_increasingTFActionPerformed
250:
251:            private void TFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_TFFocusGained
252:            // Add your handling code here:
253:                tfChanged = false; // We've just got focus so nothing can have changed
254:            }//GEN-LAST:event_TFFocusGained
255:
256:            private void oneTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_oneTFFocusLost
257:            // Add your handling code here:
258:                if (!tfChanged)
259:                    return;
260:                try {
261:                    ((Alpha) node.getJ3dNode()).setAlphaAtOneDuration(Long
262:                            .parseLong(oneTF.getText()));
263:                    notifyListeners();
264:                } catch (Exception e) {
265:                    e.printStackTrace();
266:                    ErrorManager.getDefault().notify(e);
267:                }
268:            }//GEN-LAST:event_oneTFFocusLost
269:
270:            private void increasingTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_increasingTFFocusLost
271:            // Add your handling code here:
272:                if (!tfChanged)
273:                    return;
274:                try {
275:                    ((Alpha) node.getJ3dNode()).setIncreasingAlphaDuration(Long
276:                            .parseLong(increasingTF.getText()));
277:                    notifyListeners();
278:                } catch (Exception e) {
279:                    e.printStackTrace();
280:                    ErrorManager.getDefault().notify(e);
281:                }
282:            }//GEN-LAST:event_increasingTFFocusLost
283:
284:            private void zeroTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_zeroTFFocusLost
285:            // Add your handling code here
286:                if (!tfChanged)
287:                    return;
288:                try {
289:                    ((Alpha) node.getJ3dNode()).setAlphaAtZeroDuration(Long
290:                            .parseLong(zeroTF.getText()));
291:                    notifyListeners();
292:                } catch (Exception e) {
293:                    e.printStackTrace();
294:                    ErrorManager.getDefault().notify(e);
295:                }
296:            }//GEN-LAST:event_zeroTFFocusLost
297:
298:            private void decreasingTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_decreasingTFFocusLost
299:            // Add your handling code here:
300:                if (!tfChanged)
301:                    return;
302:                try {
303:                    ((Alpha) node.getJ3dNode()).setDecreasingAlphaDuration(Long
304:                            .parseLong(decreasingTF.getText()));
305:                    notifyListeners();
306:                } catch (Exception e) {
307:                    e.printStackTrace();
308:                    ErrorManager.getDefault().notify(e);
309:                }
310:            }//GEN-LAST:event_decreasingTFFocusLost
311:
312:            /**
313:             * Set the GUI controls for represent node
314:             */
315:            protected void setControls() {
316:                Alpha alpha = (Alpha) node.getJ3dNode();
317:
318:                alphaAtZero = alpha.getAlphaAtZeroDuration();
319:                alphaAtOne = alpha.getAlphaAtOneDuration();
320:                alphaIncreasing = alpha.getIncreasingAlphaDuration();
321:                alphaDecreasing = alpha.getDecreasingAlphaDuration();
322:
323:                zeroTF.setText(Long.toString(alphaAtZero));
324:                oneTF.setText(Long.toString(alphaAtOne));
325:                increasingTF.setText(Long.toString(alphaIncreasing));
326:                decreasingTF.setText(Long.toString(alphaDecreasing));
327:            }
328:
329:            public void applyChanges() {
330:                setControls();
331:            }
332:
333:            public void resetChanges() {
334:                Alpha alpha = (Alpha) node.getJ3dNode();
335:
336:                alpha.setAlphaAtZeroDuration(alphaAtZero);
337:                alpha.setAlphaAtOneDuration(alphaAtOne);
338:                alpha.setIncreasingAlphaDuration(alphaIncreasing);
339:                alpha.setDecreasingAlphaDuration(alphaDecreasing);
340:
341:                zeroTF.setText(Long.toString(alphaAtZero));
342:                oneTF.setText(Long.toString(alphaAtOne));
343:                increasingTF.setText(Long.toString(alphaIncreasing));
344:                decreasingTF.setText(Long.toString(alphaDecreasing));
345:
346:                notifyListeners();
347:            }
348:
349:            private void notifyListeners() {
350:                if (changeListener != null)
351:                    changeListener.alphaChanged((Alpha) node.getJ3dNode());
352:            }
353:
354:            // Variables declaration - do not modify//GEN-BEGIN:variables
355:            private javax.swing.JPanel jPanel3;
356:            private javax.swing.JPanel jPanel1;
357:            private javax.swing.JTextField increasingTF;
358:            private javax.swing.JLabel decreaseL;
359:            private javax.swing.JLabel oneL;
360:            private javax.swing.JLabel zeroL;
361:            private javax.swing.JTextField zeroTF;
362:            private javax.swing.JTextField oneTF;
363:            private org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.panels.CommonNodeComponentPanel ncCommonP;
364:            private javax.swing.JTextField decreasingTF;
365:            private javax.swing.JLabel jLabel4;
366:            private javax.swing.JLabel increaseL;
367:            private javax.swing.JLabel jLabel3;
368:            private javax.swing.JLabel jLabel2;
369:            private javax.swing.JLabel jLabel1;
370:
371:            // End of variables declaration//GEN-END:variables
372:
373:            public void removeUpdate(final javax.swing.event.DocumentEvent p1) {
374:                tfChanged = true;
375:            }
376:
377:            public void changedUpdate(final javax.swing.event.DocumentEvent p1) {
378:                tfChanged = true;
379:            }
380:
381:            public void insertUpdate(final javax.swing.event.DocumentEvent p1) {
382:                tfChanged = true;
383:            }
384:
385:            /**
386:             * Set capability bits for read-only operations on this
387:             * Nodes properties
388:             */
389:            protected void setReadCapabilityBits(NodeComponent node) {
390:            }
391:
392:            /**
393:             * Set capability bits for full read/write access to this
394:             * nodes properties
395:             */
396:            protected void setReadWriteCapabilityBits(NodeComponent node) {
397:            }
398:
399:            /**
400:             * Get the CommonNodeComponentPanel
401:             */
402:            protected org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.panels.CommonNodeComponentPanel getCommonNCPanel() {
403:                return ncCommonP;
404:            }
405:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.