Source Code Cross Referenced for MaterialPanel.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/MaterialPanel.java,v 1.1 2005/04/20 22:21:05 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 javax.vecmath.Color3f;
023:
024:        import java.awt.Color;
025:        import org.jdesktop.j3dedit.scenegraph.SGMaterial;
026:        import org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.NodeComponentEditorPanel;
027:
028:        /**
029:         * @author Paul Byrne
030:         * @version $Id: MaterialPanel.java,v 1.1 2005/04/20 22:21:05 paulby Exp $
031:         */
032:        public class MaterialPanel extends NodeComponentEditorPanel {
033:
034:            private float origShininess;
035:            private boolean origEnable;
036:            private Color3f origAmbient = new Color3f();
037:            private Color3f origDiffuse = new Color3f();
038:            private Color3f origEmissive = new Color3f();
039:            private Color3f origSpecular = new Color3f();
040:            private boolean wasNull;
041:
042:            private java.awt.CardLayout cardLayout;
043:
044:            public MaterialPanel() {
045:                super ();
046:                initComponents();
047:                cardLayout = (java.awt.CardLayout) getLayout();
048:            }
049:
050:            /** This method is called from within the constructor to
051:             * initialize the form.
052:             * WARNING: Do NOT modify this code. The content of this method is
053:             * always regenerated by the FormEditor.
054:             */
055:            private void initComponents() {//GEN-BEGIN:initComponents
056:                java.awt.GridBagConstraints gridBagConstraints;
057:
058:                normalPanel = new javax.swing.JPanel();
059:                jPanel1 = new javax.swing.JPanel();
060:                lightingEnableCB = new javax.swing.JCheckBox();
061:                predefinedMaterialCB = new javax.swing.JComboBox(
062:                        new String[] { "User Defined" });
063:                ambientPanel = new javax.swing.JPanel();
064:                changeAmbientB = new javax.swing.JButton();
065:                ambientColorArea = new javax.swing.JPanel();
066:                emissivePanel = new javax.swing.JPanel();
067:                changeEmissiveB = new javax.swing.JButton();
068:                emissiveColorArea = new javax.swing.JPanel();
069:                specularPanel = new javax.swing.JPanel();
070:                changeSpecularB = new javax.swing.JButton();
071:                specularColorArea = new javax.swing.JPanel();
072:                shininessPanel = new javax.swing.JPanel();
073:                shininessSlider = new javax.swing.JSlider();
074:                shininessTF = new javax.swing.JTextField();
075:                diffusePanel = new javax.swing.JPanel();
076:                changeDiffuseB = new javax.swing.JButton();
077:                diffuseColorArea = new javax.swing.JPanel();
078:                jLabel3 = new javax.swing.JLabel();
079:                ncCommonP = new org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.panels.CommonNodeComponentPanel();
080:                nullPanel = new javax.swing.JPanel();
081:                jPanel2 = new javax.swing.JPanel();
082:                jLabel1 = new javax.swing.JLabel();
083:                createMaterialB = new javax.swing.JButton();
084:
085:                setLayout(new java.awt.CardLayout());
086:
087:                jPanel1.setLayout(new java.awt.GridBagLayout());
088:
089:                lightingEnableCB.setText("Lighting Enable");
090:                lightingEnableCB
091:                        .addItemListener(new java.awt.event.ItemListener() {
092:                            public void itemStateChanged(
093:                                    java.awt.event.ItemEvent evt) {
094:                                lightingEnableCBItemStateChanged(evt);
095:                            }
096:                        });
097:
098:                gridBagConstraints = new java.awt.GridBagConstraints();
099:                gridBagConstraints.gridx = 0;
100:                gridBagConstraints.gridy = 1;
101:                jPanel1.add(lightingEnableCB, gridBagConstraints);
102:
103:                gridBagConstraints = new java.awt.GridBagConstraints();
104:                gridBagConstraints.gridx = 3;
105:                gridBagConstraints.gridy = 1;
106:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
107:                jPanel1.add(predefinedMaterialCB, gridBagConstraints);
108:
109:                ambientPanel.setLayout(new javax.swing.BoxLayout(ambientPanel,
110:                        javax.swing.BoxLayout.Y_AXIS));
111:
112:                ambientPanel.setBorder(new javax.swing.border.TitledBorder(
113:                        "Ambient"));
114:                changeAmbientB.setText("Change ...");
115:                changeAmbientB.setToolTipText("Change the Ambient Color");
116:                changeAmbientB
117:                        .addActionListener(new java.awt.event.ActionListener() {
118:                            public void actionPerformed(
119:                                    java.awt.event.ActionEvent evt) {
120:                                changeAmbientBActionPerformed(evt);
121:                            }
122:                        });
123:
124:                ambientPanel.add(changeAmbientB);
125:
126:                ambientColorArea
127:                        .setBorder(new javax.swing.border.EtchedBorder());
128:                ambientColorArea.setMinimumSize(new java.awt.Dimension(40, 40));
129:                ambientColorArea
130:                        .setPreferredSize(new java.awt.Dimension(40, 40));
131:                ambientPanel.add(ambientColorArea);
132:
133:                gridBagConstraints = new java.awt.GridBagConstraints();
134:                gridBagConstraints.gridx = 0;
135:                gridBagConstraints.gridy = 3;
136:                jPanel1.add(ambientPanel, gridBagConstraints);
137:
138:                emissivePanel.setLayout(new javax.swing.BoxLayout(
139:                        emissivePanel, javax.swing.BoxLayout.Y_AXIS));
140:
141:                emissivePanel.setBorder(new javax.swing.border.TitledBorder(
142:                        new javax.swing.border.EtchedBorder(), "Emissive"));
143:                changeEmissiveB.setText("Change ...");
144:                changeEmissiveB.setToolTipText("Change the Ambient Color");
145:                changeEmissiveB
146:                        .addActionListener(new java.awt.event.ActionListener() {
147:                            public void actionPerformed(
148:                                    java.awt.event.ActionEvent evt) {
149:                                changeEmissiveBActionPerformed(evt);
150:                            }
151:                        });
152:
153:                emissivePanel.add(changeEmissiveB);
154:
155:                emissiveColorArea
156:                        .setBorder(new javax.swing.border.EtchedBorder());
157:                emissiveColorArea
158:                        .setMinimumSize(new java.awt.Dimension(40, 40));
159:                emissiveColorArea.setPreferredSize(new java.awt.Dimension(40,
160:                        40));
161:                emissivePanel.add(emissiveColorArea);
162:
163:                gridBagConstraints = new java.awt.GridBagConstraints();
164:                gridBagConstraints.gridx = 2;
165:                gridBagConstraints.gridy = 3;
166:                jPanel1.add(emissivePanel, gridBagConstraints);
167:
168:                specularPanel.setLayout(new javax.swing.BoxLayout(
169:                        specularPanel, javax.swing.BoxLayout.Y_AXIS));
170:
171:                specularPanel.setBorder(new javax.swing.border.TitledBorder(
172:                        new javax.swing.border.EtchedBorder(), "Specular"));
173:                changeSpecularB.setText("Change ...");
174:                changeSpecularB.setToolTipText("Change the Ambient Color");
175:                changeSpecularB
176:                        .addActionListener(new java.awt.event.ActionListener() {
177:                            public void actionPerformed(
178:                                    java.awt.event.ActionEvent evt) {
179:                                changeSpecularBActionPerformed(evt);
180:                            }
181:                        });
182:
183:                specularPanel.add(changeSpecularB);
184:
185:                specularColorArea
186:                        .setBorder(new javax.swing.border.EtchedBorder());
187:                specularColorArea
188:                        .setMinimumSize(new java.awt.Dimension(40, 40));
189:                specularColorArea.setPreferredSize(new java.awt.Dimension(40,
190:                        40));
191:                specularPanel.add(specularColorArea);
192:
193:                gridBagConstraints = new java.awt.GridBagConstraints();
194:                gridBagConstraints.gridx = 3;
195:                gridBagConstraints.gridy = 3;
196:                jPanel1.add(specularPanel, gridBagConstraints);
197:
198:                shininessPanel.setLayout(new java.awt.GridBagLayout());
199:
200:                shininessPanel.setBorder(new javax.swing.border.TitledBorder(
201:                        "Shininess"));
202:                shininessSlider.setMajorTickSpacing(10);
203:                shininessSlider.setMaximum(128);
204:                shininessSlider.setMinimum(1);
205:                shininessSlider.setPaintTicks(true);
206:                shininessSlider
207:                        .addChangeListener(new javax.swing.event.ChangeListener() {
208:                            public void stateChanged(
209:                                    javax.swing.event.ChangeEvent evt) {
210:                                shininessSliderStateChanged(evt);
211:                            }
212:                        });
213:
214:                gridBagConstraints = new java.awt.GridBagConstraints();
215:                gridBagConstraints.gridx = 1;
216:                gridBagConstraints.gridy = 0;
217:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
218:                shininessPanel.add(shininessSlider, gridBagConstraints);
219:
220:                shininessTF.setEditable(false);
221:                shininessTF.setText("0000");
222:                shininessTF.setMinimumSize(new java.awt.Dimension(28, 21));
223:                shininessTF
224:                        .addActionListener(new java.awt.event.ActionListener() {
225:                            public void actionPerformed(
226:                                    java.awt.event.ActionEvent evt) {
227:                                shininessTFActionPerformed(evt);
228:                            }
229:                        });
230:
231:                shininessTF.addFocusListener(new java.awt.event.FocusAdapter() {
232:                    public void focusLost(java.awt.event.FocusEvent evt) {
233:                        shininessTFFocusLost(evt);
234:                    }
235:                });
236:
237:                gridBagConstraints = new java.awt.GridBagConstraints();
238:                gridBagConstraints.gridx = 0;
239:                gridBagConstraints.gridy = 0;
240:                shininessPanel.add(shininessTF, gridBagConstraints);
241:
242:                gridBagConstraints = new java.awt.GridBagConstraints();
243:                gridBagConstraints.gridx = 0;
244:                gridBagConstraints.gridy = 2;
245:                gridBagConstraints.gridwidth = 4;
246:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
247:                jPanel1.add(shininessPanel, gridBagConstraints);
248:
249:                diffusePanel.setLayout(new javax.swing.BoxLayout(diffusePanel,
250:                        javax.swing.BoxLayout.Y_AXIS));
251:
252:                diffusePanel.setBorder(new javax.swing.border.TitledBorder(
253:                        "Diffuse"));
254:                changeDiffuseB.setText("Change ...");
255:                changeDiffuseB.setToolTipText("Change the Ambient Color");
256:                changeDiffuseB
257:                        .addActionListener(new java.awt.event.ActionListener() {
258:                            public void actionPerformed(
259:                                    java.awt.event.ActionEvent evt) {
260:                                changeDiffuseBActionPerformed(evt);
261:                            }
262:                        });
263:
264:                diffusePanel.add(changeDiffuseB);
265:
266:                diffuseColorArea
267:                        .setBorder(new javax.swing.border.EtchedBorder());
268:                diffuseColorArea.setMinimumSize(new java.awt.Dimension(40, 40));
269:                diffuseColorArea
270:                        .setPreferredSize(new java.awt.Dimension(40, 40));
271:                diffusePanel.add(diffuseColorArea);
272:
273:                gridBagConstraints = new java.awt.GridBagConstraints();
274:                gridBagConstraints.gridx = 1;
275:                gridBagConstraints.gridy = 3;
276:                jPanel1.add(diffusePanel, gridBagConstraints);
277:
278:                jLabel3.setText("Predefined Materials : ");
279:                gridBagConstraints = new java.awt.GridBagConstraints();
280:                gridBagConstraints.gridx = 2;
281:                gridBagConstraints.gridy = 1;
282:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
283:                jPanel1.add(jLabel3, gridBagConstraints);
284:
285:                gridBagConstraints = new java.awt.GridBagConstraints();
286:                gridBagConstraints.gridwidth = 4;
287:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
288:                jPanel1.add(ncCommonP, gridBagConstraints);
289:
290:                normalPanel.add(jPanel1);
291:
292:                add(normalPanel, "card4");
293:
294:                jPanel2.setLayout(new java.awt.GridBagLayout());
295:
296:                jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
297:                jLabel1.setText("Attribute is Null");
298:                jPanel2.add(jLabel1, new java.awt.GridBagConstraints());
299:
300:                createMaterialB.setText("Create Attribute");
301:                createMaterialB
302:                        .addActionListener(new java.awt.event.ActionListener() {
303:                            public void actionPerformed(
304:                                    java.awt.event.ActionEvent evt) {
305:                                createMaterialBActionPerformed(evt);
306:                            }
307:                        });
308:
309:                gridBagConstraints = new java.awt.GridBagConstraints();
310:                gridBagConstraints.gridx = 0;
311:                gridBagConstraints.gridy = 1;
312:                jPanel2.add(createMaterialB, gridBagConstraints);
313:
314:                nullPanel.add(jPanel2);
315:
316:                add(nullPanel, "card5");
317:
318:            }//GEN-END:initComponents
319:
320:            private void createMaterialBActionPerformed(
321:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createMaterialBActionPerformed
322:            // Add your handling code here:
323:                node = new SGMaterial(new Material(), nodeParent.getContext());
324:                if (readOnly)
325:                    setReadCapabilityBits(node.getJ3dNode());
326:                else
327:                    setReadWriteCapabilityBits(node.getJ3dNode());
328:
329:                ((Appearance) getParentJ3dNodeComponent())
330:                        .setMaterial((Material) node.getJ3dNode());
331:                setControls();
332:                cardLayout.first(this );
333:
334:                ncCommonP.startEdit(node);
335:                setUpdateRequired(true);
336:            }//GEN-LAST:event_createMaterialBActionPerformed
337:
338:            private void changeAmbientBActionPerformed(
339:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeAmbientBActionPerformed
340:            // Add your handling code here:
341:                Color newColor = org.jdesktop.j3dedit.scenegrapheditor.WindowManager
342:                        .getManager().chooseColor(origAmbient.get());
343:                if (newColor != null) {
344:                    ambientColorArea.setBackground(newColor);
345:                    ((Material) node.getJ3dNode()).setAmbientColor(new Color3f(
346:                            newColor));
347:                    setUpdateRequired(true);
348:                }
349:            }//GEN-LAST:event_changeAmbientBActionPerformed
350:
351:            private void lightingEnableCBItemStateChanged(
352:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_lightingEnableCBItemStateChanged
353:            // Add your handling code here:
354:                ((Material) node.getJ3dNode())
355:                        .setLightingEnable(lightingEnableCB.isSelected());
356:                setUpdateRequired(true);
357:            }//GEN-LAST:event_lightingEnableCBItemStateChanged
358:
359:            private void changeDiffuseBActionPerformed(
360:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeDiffuseBActionPerformed
361:            // Add your handling code here:
362:                Color newColor = org.jdesktop.j3dedit.scenegrapheditor.WindowManager
363:                        .getManager().chooseColor(origDiffuse.get());
364:                if (newColor != null) {
365:                    diffuseColorArea.setBackground(newColor);
366:                    ((Material) node.getJ3dNode()).setDiffuseColor(new Color3f(
367:                            newColor));
368:                    setUpdateRequired(true);
369:                }
370:            }//GEN-LAST:event_changeDiffuseBActionPerformed
371:
372:            private void changeEmissiveBActionPerformed(
373:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeEmissiveBActionPerformed
374:            // Add your handling code here:
375:                Color newColor = org.jdesktop.j3dedit.scenegrapheditor.WindowManager
376:                        .getManager().chooseColor(origEmissive.get());
377:                if (newColor != null) {
378:                    emissiveColorArea.setBackground(newColor);
379:                    ((Material) node.getJ3dNode())
380:                            .setEmissiveColor(new Color3f(newColor));
381:                    setUpdateRequired(true);
382:                }
383:            }//GEN-LAST:event_changeEmissiveBActionPerformed
384:
385:            private void changeSpecularBActionPerformed(
386:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeSpecularBActionPerformed
387:            // Add your handling code here:
388:                Color newColor = org.jdesktop.j3dedit.scenegrapheditor.WindowManager
389:                        .getManager().chooseColor(origSpecular.get());
390:                if (newColor != null) {
391:                    specularColorArea.setBackground(newColor);
392:                    ((Material) node.getJ3dNode())
393:                            .setSpecularColor(new Color3f(newColor));
394:                    setUpdateRequired(true);
395:                }
396:            }//GEN-LAST:event_changeSpecularBActionPerformed
397:
398:            private void shininessTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_shininessTFFocusLost
399:            // Add your handling code here:
400:            }//GEN-LAST:event_shininessTFFocusLost
401:
402:            private void shininessTFActionPerformed(
403:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shininessTFActionPerformed
404:            // Add your handling code here:
405:            }//GEN-LAST:event_shininessTFActionPerformed
406:
407:            private void shininessSliderStateChanged(
408:                    javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_shininessSliderStateChanged
409:            // Add your handling code here:
410:                java.text.NumberFormat format = java.text.NumberFormat
411:                        .getNumberInstance();
412:                shininessTF.setText(format.format((float) (shininessSlider
413:                        .getValue())));
414:                ((Material) node.getJ3dNode())
415:                        .setShininess((float) (shininessSlider.getValue()));
416:                setUpdateRequired(true);
417:            }//GEN-LAST:event_shininessSliderStateChanged
418:
419:            private void lightingEnableCBStateChanged(
420:                    javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_lightingEnableCBStateChanged
421:            // Add your handling code here:
422:                ((Material) node.getJ3dNode())
423:                        .setLightingEnable(lightingEnableCB.isSelected());
424:                setUpdateRequired(true);
425:            }//GEN-LAST:event_lightingEnableCBStateChanged
426:
427:            /**
428:             * Set the GUI controls to represent node
429:             * Store the state of the node so any subsequent changes
430:             * can be reset
431:             */
432:            protected void setControls() {
433:                if (node == null || node.getJ3dNode() == null) {
434:                    wasNull = true;
435:                    cardLayout.last(this );
436:                } else {
437:
438:                    cardLayout.first(this );
439:
440:                    wasNull = false;
441:
442:                    Material mat = (Material) node.getJ3dNode();
443:                    java.text.NumberFormat format = java.text.NumberFormat
444:                            .getNumberInstance();
445:
446:                    origShininess = mat.getShininess();
447:                    shininessSlider.setValue((int) origShininess);
448:                    shininessTF.setText(format.format(origShininess));
449:
450:                    origEnable = mat.getLightingEnable();
451:                    lightingEnableCB.setSelected(origEnable);
452:
453:                    mat.getAmbientColor(origAmbient);
454:                    mat.getDiffuseColor(origDiffuse);
455:                    mat.getEmissiveColor(origEmissive);
456:                    mat.getSpecularColor(origSpecular);
457:
458:                    ambientColorArea.setBackground(origAmbient.get());
459:                    diffuseColorArea.setBackground(origDiffuse.get());
460:                    emissiveColorArea.setBackground(origEmissive.get());
461:                    specularColorArea.setBackground(origSpecular.get());
462:                }
463:            }
464:
465:            /**
466:             * Permanently apply the changes to the node
467:             */
468:            public void applyChanges() {
469:                setControls();
470:                setUpdateRequired(false);
471:            }
472:
473:            /**
474:             * Reset the changes to the state when setControls or applyChanges
475:             * was last called
476:             */
477:            public void resetChanges() {
478:                if (node != null) {
479:                    if (wasNull) {
480:                        ((Appearance) getParentJ3dNodeComponent())
481:                                .setMaterial(null);
482:                        node = null;
483:                    } else {
484:                        Material mat = (Material) node.getJ3dNode();
485:
486:                        mat.setAmbientColor(origAmbient);
487:                        mat.setDiffuseColor(origDiffuse);
488:                        mat.setEmissiveColor(origEmissive);
489:                        mat.setSpecularColor(origSpecular);
490:
491:                        mat.setShininess(origShininess);
492:                        mat.setLightingEnable(origEnable);
493:                    }
494:                    setControls();
495:
496:                    setUpdateRequired(false);
497:                }
498:            }
499:
500:            /**
501:             * Set capability bits for read-only operations on this
502:             * Nodes properties
503:             */
504:            protected void setReadCapabilityBits(NodeComponent node) {
505:                if (node == null || node.isLive())
506:                    return;
507:
508:                node.setCapability(Material.ALLOW_COMPONENT_READ);
509:            }
510:
511:            /**
512:             * Set capability bits for full read/write access to this
513:             * nodes properties
514:             */
515:            protected void setReadWriteCapabilityBits(NodeComponent node) {
516:                if (node == null || node.isLive())
517:                    return;
518:
519:                node.setCapability(Material.ALLOW_COMPONENT_READ);
520:                node.setCapability(Material.ALLOW_COMPONENT_WRITE);
521:
522:            }
523:
524:            /**
525:             * Get the CommonNodeComponentPanel
526:             */
527:            protected org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.panels.CommonNodeComponentPanel getCommonNCPanel() {
528:                return ncCommonP;
529:            }
530:
531:            // Variables declaration - do not modify//GEN-BEGIN:variables
532:            private javax.swing.JPanel nullPanel;
533:            private javax.swing.JButton changeEmissiveB;
534:            private javax.swing.JButton changeAmbientB;
535:            private javax.swing.JPanel emissiveColorArea;
536:            private javax.swing.JPanel jPanel2;
537:            private javax.swing.JTextField shininessTF;
538:            private javax.swing.JPanel jPanel1;
539:            private javax.swing.JButton changeDiffuseB;
540:            private javax.swing.JPanel emissivePanel;
541:            private javax.swing.JComboBox predefinedMaterialCB;
542:            private javax.swing.JButton createMaterialB;
543:            private javax.swing.JPanel shininessPanel;
544:            private javax.swing.JPanel normalPanel;
545:            private javax.swing.JPanel ambientColorArea;
546:            private org.jdesktop.j3dedit.scenegrapheditor.nodeeditors.panels.CommonNodeComponentPanel ncCommonP;
547:            private javax.swing.JButton changeSpecularB;
548:            private javax.swing.JPanel diffuseColorArea;
549:            private javax.swing.JCheckBox lightingEnableCB;
550:            private javax.swing.JPanel specularColorArea;
551:            private javax.swing.JPanel ambientPanel;
552:            private javax.swing.JLabel jLabel3;
553:            private javax.swing.JLabel jLabel1;
554:            private javax.swing.JSlider shininessSlider;
555:            private javax.swing.JPanel diffusePanel;
556:            private javax.swing.JPanel specularPanel;
557:            // End of variables declaration//GEN-END:variables
558:
559:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.