001    /**
002       ##############################################################################
003       ##                                                                          ##
004       ## Appearance3DChooser                                                      ##
005       ##                                                                          ##
006       ## Copyright (C) 2009  Frederic Roudaut  <frederic.roudaut@free.fr>         ##
007       ##                                                                          ##
008       ##                                                                          ##
009       ##                                                                          ##
010       ## This program is free software: you can redistribute it and/or modify     ##
011       ## it under the terms of the GNU General Public License as published by     ##
012       ## the Free Software Foundation, either version 3 of the License, or        ##
013       ## (at your option) any later version.                                      ##
014       ##                                                                          ##
015       ## This program is distributed in the hope that it will be useful,          ##
016       ## but WITHOUT ANY WARRANTY; without even the implied warranty of           ##
017       ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            ##
018       ## GNU General Public License for more details.                             ##
019       ##                                                                          ##
020       ## You should have received a copy of the GNU General Public License        ##
021       ## along with this program.  If not, see <http://www.gnu.org/licenses/>.    ##
022       ##                                                                          ##
023       ##                                                                          ##
024       ##############################################################################
025    **/
026    
027    package com.appearance3Dchooser;
028    
029    import java.beans.PropertyChangeEvent;
030    import java.beans.PropertyChangeListener;
031    import java.awt.*;
032    import java.awt.event.*;
033    import javax.swing.*;
034    import java.beans.*;
035    import java.net.URL;
036    
037    import javax.media.j3d.TransparencyAttributes;
038    import javax.media.j3d.TextureAttributes;
039    import javax.media.j3d.Material;
040    import javax.media.j3d.Transform3D;
041    
042    
043    /**
044     *  Appearance3DChooser Class.<br/>
045     *   This is perhaps the Class you want to use for updating your objects appearances. It includes :
046     *   <ul>
047     *   <li>A main part for updating following Java3D attributes on a defined object:
048     *      <ul>
049     *       <li><strong>Material</strong></li>
050     *       <li><strong>TransparencyAttributes</strong></li>
051     *       <li><strong>TextureAttributes</strong></li>
052     *       <li><strong>Lighting</strong></li>
053     *      </ul>
054     *   </li>
055     *   <li>A menu bar with some submenus for the Help, the java3D characteristics, the user info, the java info, the system info, the parameters values info, and a About Panel.</li>
056     *   <li>three more buttons : one for OK, one for CANCEL, and one for RESET.</li>
057     *   </ul>
058     * <br/> An instance of this object fire a Property Event when a dedicated parameter is modified. If Cancel is clicked, all parameters are reseted and
059     * associated Property Events are also fired. It distinguishes the following events :
060     * <ul>
061     * <br/>
062     * <li>Material Panel 
063     *     <ul>
064     *     <li>SPECULAR </li>
065     *     <li>AMBIENT </li>
066     *     <li>EMISSIVE </li>
067     *     <li>DIFFUSE </li>
068     *     <li>COLORTARGET </li>
069     *     <li>SHININESS  </li>
070     *     <li>LIGHTING  </li>
071     *     </ul>  
072     *     <br/>
073     *     </li>
074     *
075     *  <li>Transparency Panel
076     *     <ul>
077     *     <li>TRANSPARENCY  </li>
078     *     <li>TRANSPARENCY_MODE  </li>
079     *     <li>TRANSPARENCY_SRC_BLEND_FUNCTION  </li>
080     *     <li>TRANSPARENCY_DST_BLEND_FUNCTION  </li>
081     *     </ul>
082     *     <br/>
083     *     </li>
084     *
085     * <li> Texture Panel
086     *     <ul>
087     *     <li>TEXTURE_USE  </li>
088     *     <li>TEXTURE_FILE  </li>
089     *     <li>TEXTURE_TRANSFORM  </li>
090     *     <li>TEXTURE_PERSPECTIVE_CORRECTION_MODE  </li>
091     *     <li>TEXTURE_MODE  </li>
092     *     <li>TEXTURE_BLEND  </li> 
093     *     <li>TEXTURE_COMBINE_RGB_MODE  </li> 
094     *     <li>TEXTURE_COMBINE_RGB_SOURCE  </li> 
095     *     <li>TEXTURE_COMBINE_RGB_FUNCTION  </li> 
096     *     <li>TEXTURE_COMBINE_RGB_SCALE  </li>
097     *     <li>TEXTURE_COMBINE_ALPHA_MODE  </li> 
098     *     <li>TEXTURE_COMBINE_ALPHA_SOURCE  </li> 
099     *     <li>TEXTURE_COMBINE_ALPHA_FUNCTION  </li> 
100     *     <li>TEXTURE_COMBINE_ALPHA_SCALE  </li>
101     *     </ul>
102     *     <br/>
103     *     </li>
104     * </li>
105     * </ul>
106     * 
107     */    
108    public class Appearance3DChooser extends JFrame implements ActionListener, WindowListener 
109    {   
110        private static final long serialVersionUID = 1L;
111        
112        private Appearance3DChooserPanel appearance3DPan;
113       
114        protected JButton ok;
115        protected JButton cancel;  
116        protected JButton reset;  
117        protected JMenuItem info3DMenuItem;
118        protected JMenuItem aboutMenuItem;
119        protected JMenuItem helpMenuItem;  
120        protected JMenuItem infoUserMenuItem;  
121        protected JMenuItem infoSystemMenuItem;
122        protected JMenuItem infoJavaMenuItem;
123        protected JMenuItem infoParametersMenuItem;
124            
125        protected float []emissiveColorInit = {0.36f,0.85f,0.80f};
126        protected float []specularColorInit = {1.0f,1.0f,1.0f};
127        protected float []ambientColorInit = {0.2f,0.2f,0.2f};
128        protected float []diffuseColorInit = {1.0f,1.0f,1.0f};
129        protected float shininessInit = 64.0f;
130        protected int colorTargetInit = Material.DIFFUSE;
131        protected boolean lightingInit = true;
132        protected float transparencyInit = 0.0f;    
133        protected int transparencyModeInit = TransparencyAttributes.NONE;
134        protected int transparencySrcBlendFunctionInit = TransparencyAttributes.BLEND_SRC_ALPHA;
135        protected int transparencyDstBlendFunctionInit = TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA;
136        protected Transform3D textureTransformInit = new Transform3D();
137        protected boolean textureUseInit = false;
138        protected URL textureFileInit = (new Info()).getClass().getResource("resources/DefaultTexture.png");
139        protected int texturePerspectiveCorrectionModeInit = TextureAttributes.NICEST;
140        protected int textureModeInit = TextureAttributes.REPLACE;
141        protected float []textureBlendColorInit = {0.5f,0.5f,0.5f,0.5f};
142        protected int textureCombineRGBModeInit = TextureAttributes.COMBINE_MODULATE;
143        protected int []textureCombineRGBSourceInit = {TextureAttributes.COMBINE_TEXTURE_COLOR, 
144                                                       TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE, 
145                                                       TextureAttributes.COMBINE_CONSTANT_COLOR};
146        protected int []textureCombineRGBFunctionInit = {TextureAttributes.COMBINE_SRC_COLOR, 
147                                                         TextureAttributes.COMBINE_SRC_COLOR, 
148                                                         TextureAttributes.COMBINE_SRC_COLOR};
149        protected int textureCombineRGBScaleInit = 1;
150        protected int textureCombineAlphaModeInit = TextureAttributes.COMBINE_MODULATE;
151        protected int []textureCombineAlphaSourceInit = {TextureAttributes.COMBINE_TEXTURE_COLOR, 
152                                                         TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE, 
153                                                         TextureAttributes.COMBINE_CONSTANT_COLOR};
154        protected int []textureCombineAlphaFunctionInit = {TextureAttributes.COMBINE_SRC_ALPHA, 
155                                                           TextureAttributes.COMBINE_SRC_ALPHA, 
156                                                           TextureAttributes.COMBINE_SRC_ALPHA};
157        protected int textureCombineAlphaScaleInit = 1;
158    
159    
160        protected float []emissiveColor = {0.36f,0.85f,0.80f};
161        protected float []specularColor = {1.0f,1.0f,1.0f};
162        protected float []ambientColor = {0.2f,0.2f,0.2f};
163        protected float []diffuseColor = {1.0f,1.0f,1.0f};
164        protected float shininess = 64.0f;
165        protected int colorTarget = Material.DIFFUSE;
166        protected boolean lighting = true;
167        protected float transparency = 0.0f;
168        protected int transparencyMode = TransparencyAttributes.NONE;
169        protected int transparencySrcBlendFunction = TransparencyAttributes.BLEND_SRC_ALPHA;
170        protected int transparencyDstBlendFunction = TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA;
171        protected Transform3D textureTransform = new Transform3D();
172        protected boolean textureUse = false;
173        protected URL textureFile = (new Info()).getClass().getResource("resources/DefaultTexture.png");
174        protected int texturePerspectiveCorrectionMode = TextureAttributes.NICEST;
175        protected int textureMode = TextureAttributes.REPLACE;
176        protected float []textureBlendColor = {0.5f,0.5f,0.5f,0.5f};
177        protected int textureCombineRGBMode = TextureAttributes.COMBINE_MODULATE;
178        protected int []textureCombineRGBSource = {TextureAttributes.COMBINE_TEXTURE_COLOR, 
179                                                   TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE, 
180                                                   TextureAttributes.COMBINE_CONSTANT_COLOR};
181        protected int []textureCombineRGBFunction = {TextureAttributes.COMBINE_SRC_COLOR, 
182                                                     TextureAttributes.COMBINE_SRC_COLOR, 
183                                                     TextureAttributes.COMBINE_SRC_COLOR};
184        protected int textureCombineRGBScale = 1;
185        protected int textureCombineAlphaMode = TextureAttributes.COMBINE_MODULATE;
186        protected int []textureCombineAlphaSource = {TextureAttributes.COMBINE_TEXTURE_COLOR, 
187                                                     TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE, 
188                                                     TextureAttributes.COMBINE_CONSTANT_COLOR};
189        protected int []textureCombineAlphaFunction = {TextureAttributes.COMBINE_SRC_ALPHA, 
190                                                       TextureAttributes.COMBINE_SRC_ALPHA, 
191                                                       TextureAttributes.COMBINE_SRC_ALPHA};
192        protected int textureCombineAlphaScale = 1;        
193    
194    
195        public static final String SPECULAR = Appearance3DChooserPanel.SPECULAR;
196        public static final String AMBIENT = Appearance3DChooserPanel.AMBIENT;
197        public static final String EMISSIVE = Appearance3DChooserPanel.EMISSIVE;
198        public static final String DIFFUSE = Appearance3DChooserPanel.DIFFUSE;
199        public static final String COLORTARGET = Appearance3DChooserPanel.COLORTARGET;
200        public static final String SHININESS = Appearance3DChooserPanel.SHININESS;
201        public static final String LIGHTING = Appearance3DChooserPanel.LIGHTING;
202        public static final String TRANSPARENCY = Appearance3DChooserPanel.TRANSPARENCY;
203        public static final String TRANSPARENCY_MODE = Appearance3DChooserPanel.TRANSPARENCY_MODE;
204        public static final String TRANSPARENCY_SRC_BLEND_FUNCTION = Appearance3DChooserPanel.TRANSPARENCY_SRC_BLEND_FUNCTION;
205        public static final String TRANSPARENCY_DST_BLEND_FUNCTION = Appearance3DChooserPanel.TRANSPARENCY_DST_BLEND_FUNCTION;    
206        public static final String TEXTURE_USE = Appearance3DChooserPanel.TEXTURE_USE;
207        public static final String TEXTURE_FILE = Appearance3DChooserPanel.TEXTURE_FILE;
208        public static final String TEXTURE_TRANSFORM = Appearance3DChooserPanel.TEXTURE_TRANSFORM;
209        public static final String TEXTURE_PERSPECTIVE_CORRECTION_MODE = Appearance3DChooserPanel.TEXTURE_PERSPECTIVE_CORRECTION_MODE;
210        public static final String TEXTURE_MODE = Appearance3DChooserPanel.TEXTURE_MODE;
211        public static final String TEXTURE_BLEND = Appearance3DChooserPanel.TEXTURE_BLEND;
212        public static final String TEXTURE_COMBINE_RGB_MODE = Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_MODE;
213        public static final String TEXTURE_COMBINE_RGB_SOURCE = Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SOURCE;
214        public static final String TEXTURE_COMBINE_RGB_FUNCTION = Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_FUNCTION;
215        public static final String TEXTURE_COMBINE_RGB_SCALE = Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SCALE;
216        public static final String TEXTURE_COMBINE_ALPHA_MODE = Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_MODE;
217        public static final String TEXTURE_COMBINE_ALPHA_SOURCE = Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SOURCE;
218        public static final String TEXTURE_COMBINE_ALPHA_FUNCTION = Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_FUNCTION;
219        public static final String TEXTURE_COMBINE_ALPHA_SCALE = Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SCALE;
220    
221    
222        protected PropertyChangeSupport boundSupport;
223    
224    
225        /**
226         * Main Appearance3DChooser constructor. Generate a Frame with all the Panes associated to control 
227         * some of the JAVA 3D Appearance attributes.  
228         *
229         * @param title Title for the frame.
230         * @param showMaterial set it to true if you want to see the Material Panel.
231         * @param showTransparency set it to true if you want to see the Transparency Panel.
232         * @param showTexture set it to true if you want to see the Texture Panel.
233         * @param showRendering set it to true if you want to see the Rendering Panel.
234         */
235        public Appearance3DChooser(String title, boolean showMaterial, boolean showTransparency, boolean showTexture, boolean showRendering)
236        {
237            this(title, showMaterial, showTransparency,  showTexture, showRendering, true);
238        }
239        
240        
241        
242        /**
243         * Main Appearance3DChooser constructor. Generate a Frame with all the Panes associated to control 
244         * some of the JAVA 3D Appearance attributes.  
245         *
246         * @param title Title for the frame.
247         * @param showMaterial set it to true if you want to see the Material Panel.
248         * @param showTransparency set it to true if you want to see the Transparency Panel.
249         * @param showTexture set it to true if you want to see the Texture Panel.
250         * @param showRendering set it to true if you want to see the Rendering Panel.
251         */
252        public Appearance3DChooser(String title, boolean showMaterial, boolean showTransparency, boolean showTexture, boolean showRendering, boolean show)
253        {
254            boundSupport  = new PropertyChangeSupport(this);
255            appearance3DPan = new Appearance3DChooserPanel(showMaterial, showTransparency, showTexture, showRendering);
256    
257            // Initialize parameters
258            setInitParameters();                            
259    
260            //Add OK, Reset and Cancel Button
261            ok = new JButton(Info.ressources.getObject("OK").toString());
262            ok.addActionListener(this);
263            cancel = new JButton(Info.ressources.getObject("Cancel").toString());
264            cancel.addActionListener(this); 
265            reset = new JButton(Info.ressources.getObject("Reset").toString());
266            reset.addActionListener(this);  
267            
268            setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
269            setTitle(title);
270            addWindowListener(this);
271            getContentPane().setLayout(new GridBagLayout());
272    
273            GridBagConstraints c = new GridBagConstraints();
274            c.gridx = 0; c.gridy = 0;
275            c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH;
276            c.gridwidth = GridBagConstraints.REMAINDER;
277            c.insets = new Insets(10,10,10,10);
278            getContentPane().add(appearance3DPan,c);
279            c.gridy++; c.gridwidth = 1;
280            getContentPane().add(new JPanel(),c);
281            c.gridx++; c.weightx = 0;
282            c.insets = new Insets(8,8,8,2);
283            getContentPane().add(reset,c);
284            c.gridx++; c.weightx = 0;
285            c.insets = new Insets(8,2,8,2);
286            getContentPane().add(cancel,c);
287            c.gridx++; c.weightx = 0;
288            c.insets = new Insets(8,2,8,8);
289            getContentPane().add(ok,c);
290            getRootPane().setDefaultButton(ok);
291            
292            
293            //Add a Menu Bar
294            //Create the menu bar.
295            JMenuBar menuBar = new JMenuBar();
296            //Build the first menu.
297            JMenu menu = new JMenu("?");
298            //menu.setMnemonic(KeyEvent.VK_I);
299            
300            //a Submenu for System (CPU, OS, Memory ...) Info
301            infoSystemMenuItem = new JMenuItem(Info.ressources.getObject("System_Info").toString(), KeyEvent.VK_S);
302            infoSystemMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
303            infoSystemMenuItem.addActionListener(this);
304            menu.add(infoSystemMenuItem);
305            //a Submenu for 3D Characteristics
306            info3DMenuItem = new JMenuItem(Info.ressources.getObject("3D_Info").toString(), KeyEvent.VK_I);
307            info3DMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
308            info3DMenuItem.addActionListener(this);
309            menu.add(info3DMenuItem);
310            //a Submenu for Java Info
311            infoJavaMenuItem = new JMenuItem(Info.ressources.getObject("Java_Info").toString(), KeyEvent.VK_J);
312            infoJavaMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, ActionEvent.ALT_MASK));
313            infoJavaMenuItem.addActionListener(this);
314            menu.add(infoJavaMenuItem);
315            //a Submenu for User Info
316            infoUserMenuItem = new JMenuItem(Info.ressources.getObject("User_Info").toString(), KeyEvent.VK_U);
317            infoUserMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_4, ActionEvent.ALT_MASK));
318            infoUserMenuItem.addActionListener(this);
319            menu.add(infoUserMenuItem);
320            //a Submenu for Parameters Values Info
321            infoParametersMenuItem = new JMenuItem(Info.ressources.getObject("Parameters_Info").toString(), KeyEvent.VK_P);
322            infoParametersMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_5, ActionEvent.ALT_MASK));
323            infoParametersMenuItem.addActionListener(this);
324            menu.add(infoParametersMenuItem);
325            //a Submenu for Help on components
326            helpMenuItem = new JMenuItem(Info.ressources.getObject("Help").toString(),KeyEvent.VK_E);
327            helpMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_6, ActionEvent.ALT_MASK));
328            helpMenuItem.addActionListener(this);
329            menu.add(helpMenuItem);
330            //a Submenu for About Info
331            aboutMenuItem = new JMenuItem(Info.ressources.getObject("About").toString(), KeyEvent.VK_A);
332            aboutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_7, ActionEvent.ALT_MASK));
333            aboutMenuItem.addActionListener(this);
334            menu.add(aboutMenuItem);
335            menuBar.add(Box.createHorizontalGlue());
336            menuBar.add(menu);
337    
338            setJMenuBar(menuBar);
339    
340            pack();
341            setResizable(false);
342            setVisible(show);                       
343        }
344        
345    
346        /**
347         * Show or Hide the Windows.
348         * @param on true if the windows has to be shown, falsed otherwise.     
349         */  
350        public void showWindow(boolean on)
351        {
352            setVisible(on);         
353        }     
354        
355        /**
356         * Set all the parameters to their init value.     
357         */  
358        public void setInitParameters()
359        {
360            appearance3DPan.setAmbientColor(ambientColorInit);
361            appearance3DPan.setDiffuseColor(diffuseColorInit); 
362            appearance3DPan.setEmissiveColor(emissiveColorInit);  
363            appearance3DPan.setSpecularColor(specularColorInit);
364            appearance3DPan.setShininess(shininessInit);
365            appearance3DPan.setColorTarget(colorTargetInit);      
366            appearance3DPan.setLighting(lightingInit);
367            appearance3DPan.setTransparency(transparencyInit);
368            appearance3DPan.setTransparencyMode(transparencyModeInit);
369            appearance3DPan.setTransparencySrcBlendFunction(transparencySrcBlendFunctionInit);
370            appearance3DPan.setTransparencyDstBlendFunction(transparencyDstBlendFunctionInit);
371            appearance3DPan.setTextureUse(textureUseInit);
372            appearance3DPan.setTextureTransform(textureTransformInit);              
373            appearance3DPan.setDefaultTextureFile(textureFileInit);                 
374            appearance3DPan.setTexturePerspectiveCorrectionMode(texturePerspectiveCorrectionModeInit);
375            appearance3DPan.setTextureMode(textureModeInit);
376            appearance3DPan.setTextureBlendColor(textureBlendColorInit);        
377            appearance3DPan.setTextureCombineRGBMode(textureCombineRGBModeInit);
378            appearance3DPan.setTextureCombineRGBSource(textureCombineRGBSourceInit);
379            appearance3DPan.setTextureCombineRGBFunction(textureCombineRGBFunctionInit);
380            appearance3DPan.setTextureCombineRGBScale(textureCombineRGBScaleInit);  
381            appearance3DPan.setTextureCombineAlphaMode(textureCombineAlphaModeInit);
382            appearance3DPan.setTextureCombineAlphaSource(textureCombineAlphaSourceInit);
383            appearance3DPan.setTextureCombineAlphaFunction(textureCombineAlphaFunctionInit);
384            appearance3DPan.setTextureCombineAlphaScale(textureCombineAlphaScaleInit);      
385        }
386    
387        /**
388         * 
389         * Called when an action is performed : the OK/CANCEL/RESET button is clicked or a menu is choosen in the menu bar
390         * @param e the related action.
391         *
392         */                       
393        public void actionPerformed(ActionEvent e) 
394        {
395            Object source = e.getSource();
396    
397            if(source == helpMenuItem)
398                {
399                    Info.showJava3DHelp();
400                }
401    
402            else if (source == info3DMenuItem) 
403                {   
404                    Info.show3DInfo();
405                }
406    
407            else if (source == infoUserMenuItem) 
408                {
409                    new com.envInfo.UserInfo();
410                }
411    
412            else if (source == infoSystemMenuItem) 
413                {   
414                    new com.envInfo.SystemInfo();
415                }
416    
417            else if (source == infoJavaMenuItem) 
418                {                   
419                    new com.envInfo.JavaInfo();
420                }
421    
422            else if (source == aboutMenuItem) 
423                {   
424                    Info.showAbout();
425                }
426            
427            else if (source == infoParametersMenuItem)
428                {
429                    new Appearance3DChooserInfo(this);
430                }
431    
432            else if(source == ok) 
433                {
434                    setVisible(false);
435                    dispose(); 
436                }
437    
438            else if (source == cancel) 
439                {   
440                    // Reset all the parameters if cancel
441                    setInitParameters();                        
442                    setVisible(false);               
443                    dispose();                              
444                }
445    
446            else if (source == reset) 
447                {   
448                    // Reset all the parameters 
449                    setInitParameters();                                    
450                }
451        }
452    
453        /**
454         * 
455         * Called when the Main JFrame is in the process of being closed.
456         * @param w the related event.
457         *
458         */                           
459        public void windowClosing ( WindowEvent w )
460        {   
461            // called when user closes the JFrame.
462            // Reset all the parameters if closing
463            setInitParameters();
464            //setVisible(false);
465            dispose(); 
466        }
467    
468        /**
469         * 
470         * Called when user Deactivates the Main JFrame.
471         * @param w the related event.
472         *
473         */                           
474        public void windowDeactivated ( WindowEvent w )
475        {
476        }
477    
478        /**
479         * 
480         * Called when user Activates the Main JFrame.
481         * @param w the related event.
482         *
483         */                           
484        public void windowActivated ( WindowEvent w )
485        {
486        }
487    
488        /**
489         * 
490         * Called when user Deiconifies the Main JFrame.
491         * @param w the related event.
492         *
493         */                           
494        public void windowDeiconified ( WindowEvent w )
495        {
496        }
497    
498        /**
499         * 
500         * Called when user iconifies the Main JFrame.
501         * @param w the related event.
502         *
503         */                           
504        public void windowIconified ( WindowEvent w )
505        {
506        }
507    
508        /**
509         * 
510         * Called when the Main JFrame is closed.
511         * @param w the related event.
512         *
513         */                           
514        public void windowClosed ( WindowEvent w )
515        {
516        }
517        
518        /**
519         * 
520         * Called when the Main JFrame has been opened.
521         * @param w the related event.
522         *
523         */                           
524        public void windowOpened ( WindowEvent w )
525        {
526        }
527    
528       
529        /**
530         * 
531         * Must be called before listening any Property change. 
532         *
533         */                           
534        public void runListeners()
535        {
536            if (appearance3DPan == null) return;
537    
538            appearance3DPan.addPropertyChangeListener(new PropertyChangeListener() {
539                    public void propertyChange(PropertyChangeEvent evt) 
540                    {
541                        if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.SPECULAR) == 0)
542                            {
543                                updateSpecularColor(getSpecularColor());                               
544                            }
545                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.AMBIENT) == 0)
546                            {
547                                updateAmbientColor(getAmbientColor());
548                            }
549                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.EMISSIVE) == 0)
550                            {
551                                updateEmissiveColor(getEmissiveColor());
552                            }
553                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.DIFFUSE) == 0)
554                            {
555                                updateDiffuseColor(getDiffuseColor());
556                            }
557                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.COLORTARGET) == 0)
558                            {
559                                updateColorTarget(getColorTarget());
560                            }
561                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.SHININESS) == 0)
562                            {
563                                updateShininess(getShininess());
564                            }
565                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.LIGHTING) == 0)
566                            {
567                                updateLighting(getLighting());
568                            }
569                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY) == 0)
570                            {
571                                updateTransparency(getTransparency());
572                            }
573                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY_MODE) == 0)
574                            {
575                                updateTransparencyMode(getTransparencyMode());
576                            }
577                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY_SRC_BLEND_FUNCTION) == 0)
578                            {
579                                updateTransparencySrcBlendFunction(getTransparencySrcBlendFunction());
580                            }
581                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TRANSPARENCY_DST_BLEND_FUNCTION) == 0)
582                            {
583                                updateTransparencyDstBlendFunction(getTransparencyDstBlendFunction());
584                            }
585                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_USE) == 0)
586                            {
587                                updateTextureUse(isTextureSet());
588                            }
589                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_FILE) == 0)
590                            {
591                                updateTextureFile(getTextureFile());
592                            }
593                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_TRANSFORM) == 0)
594                            {
595                                updateTextureTransform(getTextureTransform());
596                            }
597                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_PERSPECTIVE_CORRECTION_MODE) == 0)
598                            {
599                                updateTexturePerspectiveCorrectionMode(getTexturePerspectiveCorrectionMode());
600                            }
601                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_MODE) == 0)
602                            {
603                                updateTextureMode(getTextureMode());
604                            }
605                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_BLEND) == 0)
606                            {
607                                updateTextureBlendColor(getTextureBlendColor());
608                            }
609                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_MODE) == 0)
610                            {                          
611                                updateTextureCombineRGBMode(getTextureCombineRGBMode());
612                            }
613                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SOURCE) == 0)
614                            {
615                                updateTextureCombineRGBSource(getTextureCombineRGBSource());                            
616                            }
617                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_FUNCTION) == 0)
618                            {
619                                updateTextureCombineRGBFunction(getTextureCombineRGBFunction());                        
620                            }
621                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SCALE) == 0)
622                            {
623                                updateTextureCombineRGBScale(getTextureCombineRGBScale());                      
624                            }
625                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_MODE) == 0)
626                            {
627                                updateTextureCombineAlphaMode(getTextureCombineAlphaMode());
628                            }
629                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SOURCE) == 0)
630                            {
631                                updateTextureCombineAlphaSource(getTextureCombineAlphaSource());
632                            }
633                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_FUNCTION) == 0)
634                            {
635                                updateTextureCombineAlphaFunction(getTextureCombineAlphaFunction());
636                            }
637                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SCALE) == 0)
638                            {
639                                updateTextureCombineAlphaScale(getTextureCombineAlphaScale());
640                            }
641                    }});
642        }
643        
644    
645        /**
646         * 
647         * Add a Property Change Listener.
648         * @param s the string describing it.
649         * @param l the Property Change Listener.
650         *
651         */                           
652        public void addPropertyChangeListener(String s, PropertyChangeListener l) 
653        {
654            boundSupport.addPropertyChangeListener(s, l);
655        }
656    
657        /**
658         * 
659         * Add a Property Change Listener.
660         * @param l the Property Change Listener.
661         *
662         */                           
663        public void addPropertyChangeListener(PropertyChangeListener l) 
664        {
665            boundSupport.addPropertyChangeListener(l);
666        }
667    
668        /**
669         * 
670         * Remove a Property Change Listener.
671         * @param l the Property Change Listener.
672         *
673         */                           
674        public void removePropertyChangeListener(PropertyChangeListener l) 
675        {
676            boundSupport.removePropertyChangeListener(l);
677        }
678    
679        /**
680         * 
681         * Return the Apparence3DChooser Panel.
682         * @return the Apparence3DChooser Panel.
683         *
684         */                           
685        private Appearance3DChooserPanel getPickerPan()
686        {
687            return appearance3DPan;
688        }
689        
690        
691        /**
692         * 
693         * Return the Specular Color.
694         * @return the Specular Color in (R,G,B).
695         *
696         */                           
697        public float[] getSpecularColor()
698        {
699            return getPickerPan().getSpecularColor();
700        }
701    
702        /**
703         * 
704         * Set the Specular Color.
705         * @param r the Specular Color in R.
706         * @param g the Specular Color in G.
707         * @param b the Specular Color in B.
708         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
709         *
710         */                           
711        public void setSpecularColor(float r, float g, float b, boolean init)
712        {
713            specularColor[0] = r;
714            specularColor[1] = g;
715            specularColor[2] = b;
716            
717            if(init)
718                {
719                    specularColorInit[0] = r;
720                    specularColorInit[1] = g;
721                    specularColorInit[2] = b;                
722                    getPickerPan().setSpecularColor(specularColor);                   
723                }
724            else
725                {
726                    getPickerPan().setSpecularColor(specularColor);                   
727                    boundSupport.firePropertyChange(Appearance3DChooser.SPECULAR,specularColorInit,specularColor);
728                }
729        }
730    
731    
732        /**
733         * 
734         * Internal update of the Specular Color Parameters and fire of an associated property.
735         * @param c the Specular Color in (R,G,B).
736         *
737         */                           
738        private void updateSpecularColor (float []c)
739        {
740            float []lastSpecular = specularColor;
741            specularColor = c;
742            boundSupport.firePropertyChange(Appearance3DChooser.SPECULAR,lastSpecular,specularColor);
743        }
744        
745    
746        /**
747         * 
748         * Return the Ambient Color.
749         * @return the Ambient Color in (R,G,B).
750         *
751         */                               
752        public float[] getAmbientColor()
753        {
754            return getPickerPan().getAmbientColor();
755        }
756        
757        /**
758         * 
759         * Set the Ambient Color.
760         * @param r the Ambient Color in R.
761         * @param g the Ambient Color in G.
762         * @param b the Ambient Color in B.
763         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
764         *
765         */                           
766        public void setAmbientColor(float r, float g, float b, boolean init)
767        {    
768            ambientColor[0] = r;
769            ambientColor[1] = g;
770            ambientColor[2] = b;            
771            
772            if(init)
773                {
774                    ambientColorInit[0] = r;
775                    ambientColorInit[1] = g;
776                    ambientColorInit[2] = b;
777                    getPickerPan().setAmbientColor(ambientColor);                           
778                }
779    
780            else
781                {
782                    getPickerPan().setAmbientColor(ambientColor);                           
783                    boundSupport.firePropertyChange(Appearance3DChooser.AMBIENT,ambientColorInit,ambientColor);
784                }
785        }
786    
787        /**
788         * 
789         * Internal update of the Ambient Color Parameters and fire of an associated property.
790         * @param c the Ambient Color in (R,G,B).
791         *
792         */                           
793        private void updateAmbientColor (float []c)
794        {
795            float []lastAmbient = ambientColor;
796            ambientColor = c;
797            boundSupport.firePropertyChange(Appearance3DChooser.AMBIENT,lastAmbient,ambientColor);
798        }
799    
800        /**
801         * 
802         * Return the Diffuse Color.
803         * @return the Diffuse Color in (R,G,B).
804         *
805         */                               
806        public float[] getDiffuseColor()
807        {
808            return getPickerPan().getDiffuseColor();
809        }
810    
811        /**
812         * 
813         * Set the Diffuse Color
814         * @param r the Diffuse Color in R.
815         * @param g the Diffuse Color in G.
816         * @param b the Diffuse Color in B.
817         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
818         *
819         */                           
820        public void setDiffuseColor(float r, float g, float b, boolean init)
821        {
822            diffuseColor[0] = r;
823            diffuseColor[1] = g;
824            diffuseColor[2] = b;
825    
826            if(init)
827                {
828                    diffuseColorInit[0] = r;
829                    diffuseColorInit[1] = g;
830                    diffuseColorInit[2] = b;
831                    getPickerPan().setDiffuseColor(diffuseColor);               
832                }
833            else
834                {
835                    getPickerPan().setDiffuseColor(diffuseColor);               
836                    boundSupport.firePropertyChange(Appearance3DChooser.DIFFUSE,diffuseColorInit,diffuseColor);
837                }
838        }
839    
840        /**
841         * 
842         * Internal update of the Diffuse Color Parameters and fire of an associated property.
843         * @param c the Diffuse Color in (R,G,B).
844         *
845         */                           
846        private void updateDiffuseColor (float []c)
847        {
848            float []lastDiffuse = diffuseColor;
849            diffuseColor = c;
850            boundSupport.firePropertyChange(Appearance3DChooser.DIFFUSE,lastDiffuse,diffuseColor);
851        }
852        
853        /**
854         * 
855         * Return the Emissive Color.
856         * @return the Emissive Color in (R,G,B).
857         *
858         */                               
859        public float[] getEmissiveColor()
860        {
861            return getPickerPan().getEmissiveColor();
862        }
863    
864        /**
865         * 
866         * Set the Emissive Color.
867         * @param r the Emissive Color in R.
868         * @param g the Emissive Color in G.
869         * @param b the Emissive Color in B.
870         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
871         *
872         */                           
873        public void setEmissiveColor(float r, float g, float b, boolean init)
874        {
875            emissiveColor[0] = r;
876            emissiveColor[1] = g;
877            emissiveColor[2] = b;
878            
879            if(init)
880                {
881                    emissiveColorInit[0] = r;
882                    emissiveColorInit[1] = g;
883                    emissiveColorInit[2] = b;
884                    getPickerPan().setEmissiveColor(emissiveColor);             
885                }           
886            else
887                {
888                    getPickerPan().setEmissiveColor(emissiveColor);             
889                    boundSupport.firePropertyChange(Appearance3DChooser.EMISSIVE,emissiveColorInit,emissiveColor);
890                }
891        }
892    
893        /**
894         * 
895         * Internal update of the Emissive Color Parameters and fire of an associated property.
896         * @param c the Emissive Color in (R,G,B).
897         *
898         */                           
899        private void updateEmissiveColor (float []c)
900        {
901            float []lastEmissiveColor = emissiveColor;
902            emissiveColor = c;
903            boundSupport.firePropertyChange(Appearance3DChooser.EMISSIVE,lastEmissiveColor,emissiveColor);
904        }
905        
906        /**
907         * 
908         * Return the Color Target.
909         * @return the Color Target. One of: Material.AMBIENT, Material.EMISSIVE, Material.DIFFUSE, Material.SPECULAR, 
910         * or Material.AMBIENT_AND_DIFFUSE.
911         *
912         */                               
913        public int getColorTarget()
914        {
915            return getPickerPan().getColorTarget();
916        }
917    
918        /**
919         * 
920         * Set the Color Target.
921         * @param c the Color Target. One of: Material.AMBIENT, Material.EMISSIVE, Material.DIFFUSE, Material.SPECULAR, 
922         * or Material.AMBIENT_AND_DIFFUSE.
923         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
924         *
925         */                               
926        public void setColorTarget(int c, boolean init)
927        {
928            colorTarget = c;        
929            
930            if(init)
931                {
932                    colorTargetInit = c;   
933                    getPickerPan().setColorTarget(c);
934                }   
935            else
936                {
937                    getPickerPan().setColorTarget(c);
938                    boundSupport.firePropertyChange(Appearance3DChooser.COLORTARGET,colorTargetInit,colorTarget);
939                }
940        }
941        
942        /**
943         * 
944         * Internal update of the Color Target Parameters and fire of an associated property.
945         * @param c the Color Target. One of: Material.AMBIENT, Material.EMISSIVE, Material.DIFFUSE, Material.SPECULAR, 
946         * or Material.AMBIENT_AND_DIFFUSE.
947         *
948         */                               
949        private void updateColorTarget (int c)
950        {
951            int lastColorTarget = colorTarget;
952            colorTarget = c;
953            boundSupport.firePropertyChange(Appearance3DChooser.COLORTARGET,(int)lastColorTarget,(int)colorTarget);
954        }
955    
956        /**
957         * 
958         * Return the Shininess.
959         * @return the Shininess in the range [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny.
960         *
961         */                               
962        public float getShininess()
963        {
964            return getPickerPan().getShininess();
965        }
966        
967        /**
968         * 
969         * Set the Shininess.
970         * @param s the Shininess in the range [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny.
971         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
972         *
973         */                               
974        public void setShininess(float s, boolean init)
975        {
976            shininess = s;          
977            
978            if(init)
979                {
980                    shininessInit = s;              
981                    getPickerPan().setShininess(s);           
982                }
983            else
984                {
985                    getPickerPan().setShininess(s);           
986                    boundSupport.firePropertyChange(Appearance3DChooser.SHININESS,shininessInit,shininess);
987                }
988        }
989    
990        /**
991         * 
992         * Internal update of the Shininess Parameters and fire of an associated property.
993         * @param s the Shininess in the range [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny.
994         *
995         */                               
996        private void updateShininess (float s)
997        {
998            float lastShininess = shininess;
999            shininess = s;
1000            boundSupport.firePropertyChange(Appearance3DChooser.SHININESS,lastShininess,shininess);
1001        }
1002    
1003        /**
1004         * 
1005         * Return the Lighting mode.
1006         * @return true if lighting is enabled for the object, false otherwise.
1007         *
1008         */                               
1009        public boolean getLighting()
1010        {
1011            return getPickerPan().getLighting();
1012        }
1013        
1014        /**
1015         * 
1016         * Set the Lighting mode.
1017         * @param l true lighting is enabled for the object, false otherwise.
1018         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1019         *
1020         */                               
1021        public void setLighting(boolean l, boolean init)
1022        {
1023            lighting = l;   
1024    
1025            if(init)
1026                {
1027                    lightingInit = l;       
1028                    getPickerPan().setLighting(l);          
1029                }
1030            else
1031                {
1032                    getPickerPan().setLighting(l);          
1033                    boundSupport.firePropertyChange(Appearance3DChooser.LIGHTING,lightingInit,lighting);
1034                }
1035        }
1036    
1037        /**
1038         * 
1039         * Internal update of the Lighting mode Parameters and fire of an associated property.
1040         * @param l true lighting is enabled for the object, false otherwise.
1041         *
1042         */                               
1043        private void updateLighting (boolean l)
1044        {
1045            boolean lastLighting = lighting;
1046            lighting = l;
1047            boundSupport.firePropertyChange(Appearance3DChooser.LIGHTING,lastLighting,lighting);
1048        }
1049    
1050        /**
1051         * 
1052         * Return the transparency value.
1053         * @return the amount of transparency to be applied to the Appearance component object. 
1054         * The transparency values are in the range [0.0, 1.0], with 0.0 being fully opaque and 1.0 being fully transparent. 
1055         *
1056         */                               
1057        public float getTransparency()
1058        {
1059            return getPickerPan().getTransparency();
1060        }
1061        
1062        /**
1063         * 
1064         * Set the transparency value.
1065         * @param t the amount of transparency to be applied to the Appearance component object. 
1066         * The transparency values are in the range [0.0, 1.0], with 0.0 being fully opaque and 1.0 being fully transparent. 
1067         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1068         *
1069         */                               
1070        public void setTransparency(float t, boolean init)
1071        {
1072            transparency = t;   
1073            
1074            if(init)
1075                {
1076                    transparencyInit = t;                   
1077                    getPickerPan().setTransparency(t);                  
1078                }
1079            else
1080                {
1081                    getPickerPan().setTransparency(t);                  
1082                    boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY,transparencyInit,transparency);
1083                }
1084        }
1085    
1086    
1087        /**
1088         * 
1089         * Internal update of the transparency value Parameters and fire of an associated property.
1090         * @param f the amount of transparency to be applied to the Appearance component object. 
1091         * The transparency values are in the range [0.0, 1.0], with 0.0 being fully opaque and 1.0 being fully transparent. 
1092         *
1093         */                               
1094        private void updateTransparency (float f)
1095        {
1096            float lastTransparency = transparency;
1097            transparency = f;
1098            boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY,lastTransparency,transparency);
1099        }
1100    
1101    
1102        /**
1103         * 
1104         * Return the transparency Mode.
1105         * @return the transparency Mode between TransparencyAttributes.FASTEST, TransparencyAttributes.NICEST, TransparencyAttributes.SCREEN_DOOR, TransparencyAttributes.BLENDED, TransparencyAttributes.NONE 
1106         *
1107         */                               
1108        public int getTransparencyMode()
1109        {
1110            return getPickerPan().getTransparencyMode();
1111        }
1112    
1113        /**
1114         * 
1115         * Set the transparency Mode.
1116         * @param m the transparency Mode between TransparencyAttributes.FASTEST, TransparencyAttributes.NICEST, TransparencyAttributes.SCREEN_DOOR, TransparencyAttributes.BLENDED, TransparencyAttributes.NONE 
1117         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1118         *
1119         */                                  
1120        public void setTransparencyMode(int m, boolean init)
1121        {
1122            transparencyMode = m;   
1123            
1124            if(init)
1125                {
1126                    transparencyModeInit = m;               
1127                    getPickerPan().setTransparencyMode(m);          
1128                }
1129            else
1130                {
1131                    getPickerPan().setTransparencyMode(m);          
1132                    boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY_MODE,transparencyModeInit,transparencyMode);
1133                }
1134        }
1135    
1136        /**
1137         * 
1138         * Internal update of the transparency Mode Parameters and fire of an associated property.
1139         * @param m the transparency Mode between TransparencyAttributes.FASTEST, TransparencyAttributes.NICEST, TransparencyAttributes.SCREEN_DOOR, TransparencyAttributes.BLENDED, TransparencyAttributes.NONE 
1140         *
1141         */                                  
1142        private void updateTransparencyMode (int m)
1143        {
1144            int lastTransparencyMode = transparencyMode;
1145            transparencyMode = m;
1146            boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY_MODE,lastTransparencyMode,transparencyMode);
1147        }
1148    
1149        /**
1150         * 
1151         * Return the transparency Source Blend Function.
1152         * @return the transparency Source Blend Function between TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE, TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, 
1153         * TransparencyAttributes.BLEND_DST_COLOR, TransparencyAttributes.BLEND_ONE_MINUS_DST_COLOR.
1154         *
1155         */    
1156        public int getTransparencySrcBlendFunction()
1157        {
1158            return getPickerPan().getTransparencySrcBlendFunction();
1159        }
1160        
1161        /**
1162         * 
1163         * Set the transparency Source Blend Function.
1164         * @param f the transparency Source Blend Function between TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE, TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, 
1165         * TransparencyAttributes.BLEND_DST_COLOR, TransparencyAttributes.BLEND_ONE_MINUS_DST_COLOR.
1166         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1167         *
1168         */    
1169        public void setTransparencySrcBlendFunction(int f, boolean init)
1170        {
1171            transparencySrcBlendFunction = f;   
1172            
1173            if(init)
1174                {
1175                    transparencySrcBlendFunctionInit = f;                   
1176                    getPickerPan().setTransparencySrcBlendFunction(f);                  
1177                }   
1178            else
1179                {
1180                    getPickerPan().setTransparencySrcBlendFunction(f);                  
1181                    boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY_SRC_BLEND_FUNCTION,transparencySrcBlendFunctionInit,transparencySrcBlendFunction);
1182                }
1183        }
1184    
1185        /**
1186         * 
1187         * Internal update of the transparency Source Blend Function Parameters and fire of an associated property.
1188         * @param f the transparency Source Blend Function between TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE, TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, 
1189         * TransparencyAttributes.BLEND_DST_COLOR, TransparencyAttributes.BLEND_ONE_MINUS_DST_COLOR.
1190         *
1191         */    
1192        private void updateTransparencySrcBlendFunction (int f)
1193        {
1194            int lastTransparencySrcBlendFunction = transparencySrcBlendFunction;
1195            transparencySrcBlendFunction = f;
1196            boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY_SRC_BLEND_FUNCTION,lastTransparencySrcBlendFunction,transparencySrcBlendFunction);
1197        }
1198    
1199        /**
1200         * 
1201         * Return the transparency Destination Blend Function.
1202         * @return the transparency Destination Blend Function between TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE, TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, 
1203         * TransparencyAttributes.BLEND_SRC_COLOR, TransparencyAttributes.BLEND_ONE_MINUS_SRC_COLOR.
1204         *
1205         */    
1206        public int getTransparencyDstBlendFunction()
1207        {
1208            return getPickerPan().getTransparencyDstBlendFunction();
1209        }
1210        
1211        /**
1212         * 
1213         * Set the transparency Destination Blend Function.
1214         * @param f the transparency Destination Blend Function between TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE, TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, 
1215         * TransparencyAttributes.BLEND_SRC_COLOR, TransparencyAttributes.BLEND_ONE_MINUS_SRC_COLOR.
1216         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1217         *
1218         */    
1219        public void setTransparencyDstBlendFunction(int f, boolean init)
1220        {
1221            transparencyDstBlendFunction = f;   
1222    
1223            if(init)
1224                {
1225                    transparencyDstBlendFunctionInit = f;                   
1226                    getPickerPan().setTransparencyDstBlendFunction(f);                  
1227                }
1228            else
1229                {
1230                    getPickerPan().setTransparencyDstBlendFunction(f);                  
1231                    boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY_DST_BLEND_FUNCTION,transparencyDstBlendFunctionInit,transparencyDstBlendFunction);
1232                }
1233        }    
1234    
1235        /**
1236         * 
1237         * Internal update of the transparency Destination Blend Function Parameters and fire of an associated property.
1238         * @param f the transparency Destination Blend Function between TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE, TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, 
1239         * TransparencyAttributes.BLEND_SRC_COLOR, TransparencyAttributes.BLEND_ONE_MINUS_SRC_COLOR.
1240         *
1241         */    
1242        private void updateTransparencyDstBlendFunction (int f)
1243        {
1244            int lastTransparencyDstBlendFunction = transparencyDstBlendFunction;
1245            transparencyDstBlendFunction = f;
1246            boundSupport.firePropertyChange(Appearance3DChooser.TRANSPARENCY_DST_BLEND_FUNCTION,lastTransparencyDstBlendFunction,transparencyDstBlendFunction);
1247        }
1248    
1249        /**
1250         * 
1251         * Return the Texture Transform.
1252         * @return the Texture Transform.
1253         *
1254         */    
1255        public Transform3D getTextureTransform()
1256        {
1257            return getPickerPan().getTextureTransform();
1258        }
1259    
1260        /**
1261         * 
1262         * Set the Texture Transform.
1263         * @param t the Texture Transform.
1264         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1265         *
1266         */    
1267        public void setTextureTransform(Transform3D t, boolean init)
1268        {
1269            textureTransform = new Transform3D(t);   
1270            
1271            if(init)
1272                {
1273                    textureTransformInit = new Transform3D(t);                      
1274                    getPickerPan().setTextureTransform(t);
1275                }
1276            else
1277                {           
1278                    getPickerPan().setTextureTransform(t);
1279                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_TRANSFORM,textureTransformInit,textureTransform);
1280                }
1281    
1282        }
1283    
1284        /**
1285         * 
1286         * Internal update of the Texture Transform Parameters and fire of an associated property.
1287         * @param t the Texture Transform.
1288         *
1289         */    
1290        private void updateTextureTransform(Transform3D t)
1291        {
1292            Transform3D lastTextureTransform = new Transform3D(textureTransform);
1293            textureTransform = t;
1294            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_TRANSFORM,lastTextureTransform,textureTransform);
1295        }
1296    
1297        /**
1298         * 
1299         * Return the Texture Transform Scale on X axis.
1300         * @return the Texture Transform Scale on X axis.
1301         *
1302         */    
1303        public float getTextureTransformScaleX()
1304        {
1305            return getPickerPan().getTextureTransformScaleX();
1306        }
1307    
1308        /**
1309         * 
1310         * Set the Texture Transform Scale on X axis.
1311         * @param v the Texture Transform Scale on X axis.
1312         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1313         *
1314         */    
1315        public void setTextureTransformScaleX(float v, boolean init)
1316        {
1317            getPickerPan().setTextureTransformScaleX(v);
1318    
1319            if (init)
1320                {
1321                    textureTransformInit = getTextureTransform();
1322                }
1323        }
1324    
1325        /**
1326         * 
1327         * Return the Texture Transform Scale on Y axis.
1328         * @return the Texture Transform Scale on Y axis.
1329         *
1330         */    
1331        public float getTextureTransformScaleY()
1332        {
1333            return getPickerPan().getTextureTransformScaleY();
1334        }
1335    
1336        /**
1337         * 
1338         * Set the Texture Transform Scale on Y axis.
1339         * @param v the Texture Transform Scale on Y axis.
1340         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1341         *
1342         */    
1343        public void setTextureTransformScaleY(float v, boolean init)
1344        {
1345            getPickerPan().setTextureTransformScaleY(v);
1346            
1347            if (init)
1348                {
1349                    textureTransformInit = getTextureTransform();
1350                }
1351        }
1352    
1353        /**
1354         * 
1355         * Return the Texture Transform Translation on X axis.
1356         * @return the Texture Transform Translation on X axis.
1357         *
1358         */    
1359        public float getTextureTransformTranslatX()
1360        {
1361            return getPickerPan().getTextureTransformTranslatX();
1362        }
1363    
1364        /**
1365         * 
1366         * Set the Texture Transform Translation on X axis.
1367         * @param v the Texture Transform Translation on X axis.
1368         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1369         *
1370         */    
1371        public void setTextureTransformTranslatX(float v, boolean init)
1372        {
1373            getPickerPan().setTextureTransformTranslatX(v);
1374    
1375            if (init)
1376                {
1377                    textureTransformInit = getTextureTransform();
1378                }
1379        }
1380    
1381        /**
1382         * 
1383         * Return the Texture Transform Translation on Y axis.
1384         * @return the Texture Transform Translation on Y axis.
1385         *
1386         */    
1387        public float getTextureTransformTranslatY()
1388        {
1389            return getPickerPan().getTextureTransformTranslatY();
1390        }
1391    
1392        /**
1393         * 
1394         * Set the Texture Transform Translation on Y axis.
1395         * @param v the Texture Transform Translation on Y axis.
1396         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1397         *
1398         */    
1399        public void setTextureTransformTranslatY(float v, boolean init)
1400        {
1401            getPickerPan().setTextureTransformTranslatY(v);
1402    
1403            if (init)
1404                {
1405                    textureTransformInit = getTextureTransform();
1406                }
1407        }
1408    
1409        /**
1410         * 
1411         * Return the Texture Transform Rotation on Z axis.
1412         * @return the Texture Transform Rotation on Z axis.
1413         *
1414         */    
1415        public float getTextureTransformRotZ()
1416        {
1417            return getPickerPan().getTextureTransformRotZ();
1418        }
1419    
1420        /**
1421         * 
1422         * Set the Texture Transform Rotation on Z axis.
1423         * @param v the Texture Transform Rotation on Z axis.
1424         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1425         *
1426         */    
1427        public void setTextureTransformRotZ(float v, boolean init)
1428        {
1429            getPickerPan().setTextureTransformRotZ(v);
1430    
1431            if (init)
1432                {
1433                    textureTransformInit = getTextureTransform();
1434                }
1435        }
1436    
1437        /**
1438         * 
1439         * Return the Texture File URL.
1440         * @return the Texture File URL.
1441         *
1442         */    
1443        public URL getTextureFile()
1444        {
1445            return getPickerPan().getTextureFile();
1446        }
1447    
1448        /**
1449         * 
1450         * Set the Texture File URL.
1451         * @param f the Texture File URL.
1452         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1453         *
1454         */    
1455        public void setTextureFile(URL f, boolean init)
1456        {
1457            textureFile = f;
1458            if (init)
1459                {
1460                    textureFileInit = f;
1461                    getPickerPan().setDefaultTextureFile(f);                    
1462                }
1463            else
1464                {
1465                    getPickerPan().setTextureFile(f);                   
1466                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_FILE,textureFileInit,textureFile);
1467                }
1468        }
1469    
1470        /**
1471         * 
1472         * Internal update of the Texture File URL Parameters and fire of an associated property.
1473         * @param f the Texture File URL.
1474         *
1475         */    
1476        private void updateTextureFile (URL f)
1477        {
1478            URL lastTextureFile = textureFile;
1479            textureFile = f;
1480            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_FILE,lastTextureFile,textureFile);
1481        }
1482    
1483        /**
1484         * 
1485         * Return the Texture Mode.
1486         * @return the Texture Mode between TextureAttributes.MODULATE, TextureAttributes.DECAL, TextureAttributes.BLEND, 
1487         * TextureAttributes.REPLACE, TextureAttributes.COMBINE.
1488         *
1489         */    
1490        public int getTextureMode()
1491        {
1492            return getPickerPan().getTextureMode();
1493        }
1494    
1495        /**
1496         * 
1497         * Set the Texture Mode.
1498         * @param m the Texture Mode between TextureAttributes.MODULATE, TextureAttributes.DECAL, TextureAttributes.BLEND, 
1499         * TextureAttributes.REPLACE, TextureAttributes.COMBINE.
1500         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1501         *
1502         */    
1503        public void setTextureMode(int m, boolean init)
1504        {
1505            textureMode = m;
1506    
1507            if(init)
1508                {
1509                    textureModeInit = m;      
1510                    getPickerPan().setTextureMode(m);       
1511                }
1512            else
1513                {
1514                    getPickerPan().setTextureMode(m);                   
1515                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_MODE,textureModeInit,textureMode);
1516                }
1517        }
1518            
1519        /**
1520         * 
1521         * Internal update of the Texture Mode Parameters and fire of an associated property.
1522         * @param m the Texture Mode between TextureAttributes.MODULATE, TextureAttributes.DECAL, TextureAttributes.BLEND, 
1523         * TextureAttributes.REPLACE, TextureAttributes.COMBINE.
1524         *
1525         */    
1526        private void updateTextureMode(int m)
1527        {
1528            int lastTextureMode = textureMode;
1529            textureMode = m;
1530            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_MODE,lastTextureMode,textureMode);
1531        }
1532    
1533        /**
1534         * 
1535         * Return the Texture Blend Color.
1536         * @return the Texture Blend Color in (R,G,B,A).
1537         *
1538         */  
1539        public float[] getTextureBlendColor()
1540        {
1541            return getPickerPan().getTextureBlendColor();
1542        }
1543    
1544        /**
1545         * 
1546         * Set the Texture Blend Color. 
1547         * @param r the Texture Blend Color in R.
1548         * @param g the Texture Blend Color in G.
1549         * @param b the Texture Blend Color in B.
1550         * @param a the Texture Blend Color in A.
1551         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1552         *
1553         */  
1554        public void setTextureBlendColor(float r, float g, float b, float a, boolean init)
1555        {
1556            textureBlendColor[0] = r;
1557            textureBlendColor[1] = g;
1558            textureBlendColor[2] = b;
1559            textureBlendColor[3] = a;
1560    
1561            if(init)
1562                {
1563                    textureBlendColorInit[0] = r;
1564                    textureBlendColorInit[1] = g;
1565                    textureBlendColorInit[2] = b;
1566                    textureBlendColorInit[3] = a;
1567                    getPickerPan().setTextureBlendColor(textureBlendColor);                     
1568                }   
1569            else
1570                {
1571                    getPickerPan().setTextureBlendColor(textureBlendColor);                     
1572                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_BLEND,textureBlendColorInit,textureBlendColor);
1573                }   
1574        }
1575    
1576    
1577        /**
1578         * 
1579         * Internal update of the Texture Blend Color Parameters and fire of an associated property.
1580         * @param b the Texture Blend Color in (R,G,B,A).
1581         *
1582         */  
1583        private void updateTextureBlendColor(float []b)
1584        {
1585            float []lastTextureBlendColor = textureBlendColor;
1586            textureBlendColor = b;
1587            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_BLEND,lastTextureBlendColor,textureBlendColor);
1588        }
1589        
1590        /**
1591         * 
1592         * Return the Texture Perspective Correction Mode.
1593         * @return the Texture Perspective Correction Mode between TextureAttributes.NICEST, TextureAttributes.FASTEST.
1594         *
1595         */    
1596        public int getTexturePerspectiveCorrectionMode()
1597        {
1598            return getPickerPan().getTexturePerspectiveCorrectionMode();
1599        }
1600    
1601        /**
1602         * 
1603         * Set the Texture Perspective Correction Mode.
1604         * @param m the Texture Perspective Correction Mode between TextureAttributes.NICEST, TextureAttributes.FASTEST. 
1605         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1606         *
1607         */    
1608        public void setTexturePerspectiveCorrectionMode(int m, boolean init)
1609        {
1610            texturePerspectiveCorrectionMode = m;
1611    
1612            if(init)
1613                {
1614                    texturePerspectiveCorrectionModeInit = m;               
1615                    getPickerPan().setTexturePerspectiveCorrectionMode(m);              
1616                }
1617            else
1618                {
1619                    getPickerPan().setTexturePerspectiveCorrectionMode(m);              
1620                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_PERSPECTIVE_CORRECTION_MODE,texturePerspectiveCorrectionModeInit,texturePerspectiveCorrectionMode);
1621                }
1622        }
1623    
1624    
1625        /**
1626         * 
1627         * Internal update of the Texture Perspective Correction Mode Parameters and fire of an associated property.
1628         * @param m the Texture Perspective Correction Mode between TextureAttributes.NICEST, TextureAttributes.FASTEST. 
1629         *
1630         */    
1631        private void updateTexturePerspectiveCorrectionMode(int m)
1632        {
1633            int lastTexturePerspectiveCorrectionMode = texturePerspectiveCorrectionMode;
1634            texturePerspectiveCorrectionMode = m;
1635            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_PERSPECTIVE_CORRECTION_MODE,
1636                                            lastTexturePerspectiveCorrectionMode,
1637                                            texturePerspectiveCorrectionMode);
1638        }
1639    
1640    
1641        /**
1642         * 
1643         * Return the Texture Combine RGB Mode.
1644         * @return the Texture Combine RGB Mode between TextureAttributes.COMBINE_REPLACE, TextureAttributes.COMBINE_MODULATE, 
1645         * TextureAttributes.COMBINE_ADD, TextureAttributes.COMBINE_ADD_SIGNED, TextureAttributes.COMBINE_SUBTRACT, 
1646         * TextureAttributes.COMBINE_INTERPOLATE, TextureAttributes.COMBINE_DOT3.
1647         *
1648         */    
1649        public int getTextureCombineRGBMode()
1650        {
1651            return getPickerPan().getTextureCombineRGBMode();
1652        }
1653    
1654        /**
1655         * 
1656         * Set the Texture Combine RGB Mode 
1657         * @param m the Texture Combine RGB Mode between TextureAttributes.COMBINE_REPLACE, TextureAttributes.COMBINE_MODULATE, 
1658         * TextureAttributes.COMBINE_ADD, TextureAttributes.COMBINE_ADD_SIGNED, TextureAttributes.COMBINE_SUBTRACT, 
1659         * TextureAttributes.COMBINE_INTERPOLATE, TextureAttributes.COMBINE_DOT3. 
1660         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1661         *
1662         */    
1663        public void setTextureCombineRGBMode(int m, boolean init)
1664        {
1665            textureCombineRGBMode = m;
1666    
1667            if(init)
1668                {
1669                    textureCombineRGBModeInit = m;                  
1670                    getPickerPan().setTextureCombineRGBMode(m);                 
1671                }
1672            else
1673                {
1674                    getPickerPan().setTextureCombineRGBMode(m);                 
1675                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_MODE,textureCombineRGBModeInit,textureCombineRGBMode);
1676                }
1677        }
1678    
1679        /**
1680         * 
1681         * Internal update of the Texture Combine RGB Mode Parameters and fire of an associated property.
1682         * @param m the Texture Combine RGB Mode between TextureAttributes.COMBINE_REPLACE, TextureAttributes.COMBINE_MODULATE, 
1683         * TextureAttributes.COMBINE_ADD, TextureAttributes.COMBINE_ADD_SIGNED, TextureAttributes.COMBINE_SUBTRACT, 
1684         * TextureAttributes.COMBINE_INTERPOLATE, TextureAttributes.COMBINE_DOT3. 
1685         *
1686         */    
1687        private void updateTextureCombineRGBMode(int m)
1688        {
1689            int lastTextureCombineRGBMode = textureCombineRGBMode;
1690            textureCombineRGBMode = m;
1691            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_MODE,
1692                                            lastTextureCombineRGBMode,
1693                                            textureCombineRGBMode);
1694        }
1695    
1696        /**
1697         * 
1698         * Return the Texture Combine RGB Source.
1699         * @return the Texture Combine RGB Source between TextureAttributes.COMBINE_OBJECT_COLOR, 
1700         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1701         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1702         *
1703         */    
1704        public int[] getTextureCombineRGBSource()
1705        {
1706            return getPickerPan().getTextureCombineRGBSource();
1707        }
1708    
1709        /**
1710         * 
1711         * Set the Texture Combine RGB Source.
1712         * @param c0 the Texture Combine RGB Source C0 between TextureAttributes.COMBINE_OBJECT_COLOR, 
1713         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1714         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1715         * @param c1 the Texture Combine RGB Source C1 between TextureAttributes.COMBINE_OBJECT_COLOR, 
1716         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1717         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1718         * @param c2 the Texture Combine RGB Source C2 between TextureAttributes.COMBINE_OBJECT_COLOR, 
1719         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1720         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1721         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1722         *
1723         */    
1724        public void setTextureCombineRGBSource(int c0, int c1, int c2, boolean init)
1725        {
1726            textureCombineRGBSource[0] = c0;
1727            textureCombineRGBSource[1] = c1;
1728            textureCombineRGBSource[2] = c2;
1729    
1730            if(init)
1731                {
1732                    textureCombineRGBSourceInit[0] = c0;
1733                    textureCombineRGBSourceInit[1] = c1;
1734                    textureCombineRGBSourceInit[2] = c2;            
1735                    getPickerPan().setTextureCombineRGBSource(textureCombineRGBSource);                 
1736                }   
1737            else
1738                {
1739                    getPickerPan().setTextureCombineRGBSource(textureCombineRGBSource);                 
1740                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_SOURCE,textureCombineRGBSourceInit,textureCombineRGBSource);
1741                }
1742            
1743        }
1744    
1745        /**
1746         * 
1747         * Internal update of the Texture Combine RGB Source Parameters and fire of an associated property.
1748         * @param s the Texture Combine RGB Source (C0,C1,C2) between TextureAttributes.COMBINE_OBJECT_COLOR, 
1749         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1750         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.     
1751         *
1752         */    
1753        private void updateTextureCombineRGBSource(int[] s)
1754        {
1755            int []lastTextureCombineRGBSource = textureCombineRGBSource;
1756            textureCombineRGBSource = s;            
1757            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_SOURCE,
1758                                            lastTextureCombineRGBSource,
1759                                            textureCombineRGBSource);
1760        }
1761    
1762        /**
1763         * 
1764         * Return the Texture Combine RGB Function.
1765         * @return the Texture Combine RGB Function between TextureAttributes.COMBINE_SRC_COLOR, 
1766         * TextureAttributes.COMBINE_ONE_MINUS_SRC_COLOR, TextureAttributes.COMBINE_SRC_ALPHA, 
1767         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
1768         *
1769         */    
1770        public int[] getTextureCombineRGBFunction()
1771        {
1772            return getPickerPan().getTextureCombineRGBFunction();
1773        }
1774    
1775        /**
1776         * 
1777         * Set the Texture Combine RGB Function.
1778         * @param c0 the Texture Combine RGB Function C0 between TextureAttributes.COMBINE_SRC_COLOR, 
1779         * TextureAttributes.COMBINE_ONE_MINUS_SRC_COLOR, TextureAttributes.COMBINE_SRC_ALPHA, 
1780         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
1781         * @param c1 the Texture Combine RGB Function C1 between TextureAttributes.COMBINE_SRC_COLOR, 
1782         * TextureAttributes.COMBINE_ONE_MINUS_SRC_COLOR, TextureAttributes.COMBINE_SRC_ALPHA, 
1783         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
1784         * @param c2 the Texture Combine RGB Function C2 between TextureAttributes.COMBINE_SRC_COLOR, 
1785         * TextureAttributes.COMBINE_ONE_MINUS_SRC_COLOR, TextureAttributes.COMBINE_SRC_ALPHA, 
1786         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
1787         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1788         *
1789         */    
1790        public void setTextureCombineRGBFunction(int c0, int c1, int c2, boolean init)
1791        {
1792            textureCombineRGBFunction[0] = c0;
1793            textureCombineRGBFunction[1] = c1;
1794            textureCombineRGBFunction[2] = c2;
1795    
1796            if(init)
1797                {
1798                    textureCombineRGBFunctionInit[0] = c0;
1799                    textureCombineRGBFunctionInit[1] = c1;
1800                    textureCombineRGBFunctionInit[2] = c2;                          
1801                    getPickerPan().setTextureCombineRGBFunction(textureCombineRGBFunction);                     
1802                }   
1803            else
1804                {
1805                    getPickerPan().setTextureCombineRGBFunction(textureCombineRGBFunction);                     
1806                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_FUNCTION,textureCombineRGBFunctionInit,textureCombineRGBFunction);
1807                }
1808            
1809        }
1810    
1811    
1812        /**
1813         * 
1814         * Internal update of the Texture Combine RGB Function Parameters and fire of an associated property.
1815         * @param s the Texture Combine RGB Function (C0,C1,C2) between TextureAttributes.COMBINE_SRC_COLOR, 
1816         * TextureAttributes.COMBINE_ONE_MINUS_SRC_COLOR, TextureAttributes.COMBINE_SRC_ALPHA, 
1817         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
1818         *
1819         */    
1820        private void updateTextureCombineRGBFunction(int[] s)
1821        {
1822            int []lastTextureCombineRGBFunction = textureCombineRGBFunction;
1823            textureCombineRGBFunction = s;
1824            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_FUNCTION,
1825                                            lastTextureCombineRGBFunction,
1826                                            textureCombineRGBFunction);
1827        }
1828    
1829    
1830        /**
1831         * 
1832         * Return the Texture Combine RGB Scale.
1833         * @return the Texture Combine RGB Scale.
1834         *
1835         */  
1836        public int getTextureCombineRGBScale()
1837        {
1838            return getPickerPan().getTextureCombineRGBScale();
1839        }
1840    
1841        /**
1842         * 
1843         * Set the Texture Combine RGB Scale.
1844         * @param s the Texture Combine RGB Scale.
1845         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1846         *
1847         */  
1848        public void setTextureCombineRGBScale(int s, boolean init)
1849        {
1850            textureCombineRGBScale = s;
1851            
1852            if(init)
1853                {
1854                    textureCombineRGBScaleInit = s;      
1855                    getPickerPan().setTextureCombineRGBScale(s);                
1856                }
1857            else
1858                {
1859                    getPickerPan().setTextureCombineRGBScale(s);                
1860                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_SCALE,textureCombineRGBScaleInit,textureCombineRGBScale);
1861                }
1862        }
1863    
1864    
1865        /**
1866         * 
1867         * Internal update of the Texture Combine RGB Scale Parameters and fire of an associated property.
1868         * @param s the Texture Combine RGB Scale.
1869         *
1870         */  
1871        private void updateTextureCombineRGBScale(int s)
1872        {
1873            int lastTextureCombineRGBScale = textureCombineRGBScale;
1874            textureCombineRGBScale = s;
1875            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_RGB_SCALE,
1876                                            lastTextureCombineRGBScale,
1877                                            textureCombineRGBScale);
1878        }
1879    
1880        /**
1881         * 
1882         * Return the Texture Combine Alpha Mode.
1883         * @return the Texture Combine Alpha Mode between TextureAttributes.COMBINE_REPLACE, TextureAttributes.COMBINE_MODULATE, 
1884         * TextureAttributes.COMBINE_ADD, TextureAttributes.COMBINE_ADD_SIGNED, TextureAttributes.COMBINE_SUBTRACT, 
1885         * TextureAttributes.COMBINE_INTERPOLATE, TextureAttributes.COMBINE_DOT3.
1886         *
1887         */    
1888        public int getTextureCombineAlphaMode()
1889        {
1890            return getPickerPan().getTextureCombineAlphaMode();
1891        }
1892    
1893        /**
1894         * 
1895         * Set the Texture Combine Alpha Mode/
1896         * @param m the Texture Combine Alpha Mode between TextureAttributes.COMBINE_REPLACE, TextureAttributes.COMBINE_MODULATE, 
1897         * TextureAttributes.COMBINE_ADD, TextureAttributes.COMBINE_ADD_SIGNED, TextureAttributes.COMBINE_SUBTRACT, 
1898         * TextureAttributes.COMBINE_INTERPOLATE, TextureAttributes.COMBINE_DOT3.
1899         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1900         *
1901         */    
1902        public void setTextureCombineAlphaMode(int m, boolean init)
1903        {
1904            textureCombineAlphaMode = m;
1905    
1906            if(init)
1907                {
1908                    textureCombineAlphaModeInit = m;                
1909                    getPickerPan().setTextureCombineAlphaMode(m);               
1910                }
1911            else
1912                {
1913                    getPickerPan().setTextureCombineAlphaMode(m);               
1914                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_MODE,textureCombineAlphaModeInit,textureCombineAlphaMode);
1915                }
1916        }
1917    
1918    
1919        /**
1920         * 
1921         * Internal update of the Texture Combine Alpha Mode Parameters and fire of an associated property.
1922         * @param m the Texture Combine Alpha Mode between TextureAttributes.COMBINE_REPLACE, TextureAttributes.COMBINE_MODULATE, 
1923         * TextureAttributes.COMBINE_ADD, TextureAttributes.COMBINE_ADD_SIGNED, TextureAttributes.COMBINE_SUBTRACT, 
1924         * TextureAttributes.COMBINE_INTERPOLATE, TextureAttributes.COMBINE_DOT3.
1925         *
1926         */    
1927        private void updateTextureCombineAlphaMode(int m)
1928        {
1929            int lastTextureCombineAlphaMode = textureCombineAlphaMode;
1930            textureCombineAlphaMode = m;
1931            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_MODE,
1932                                            lastTextureCombineAlphaMode,
1933                                            textureCombineAlphaMode);
1934        }
1935        
1936        /**
1937         * 
1938         * Return the Texture Combine Alpha Source.
1939         * @return the Texture Combine Alpha Source between TextureAttributes.COMBINE_OBJECT_COLOR, 
1940         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1941         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1942         *
1943         */    
1944        public int[] getTextureCombineAlphaSource()
1945        {
1946            return getPickerPan().getTextureCombineAlphaSource();
1947        }
1948    
1949        /**
1950         * 
1951         * Set the Texture Combine Alpha Source.
1952         * @param c0 the Texture Combine Alpha Source C0 between TextureAttributes.COMBINE_OBJECT_COLOR, 
1953         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1954         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1955         * @param c1 the Texture Combine Alpha Source C1 between TextureAttributes.COMBINE_OBJECT_COLOR, 
1956         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1957         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1958         * @param c2 the Texture Combine Alpha Source C2 between TextureAttributes.COMBINE_OBJECT_COLOR, 
1959         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1960         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1961         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
1962         *
1963         */    
1964        public void setTextureCombineAlphaSource(int c0, int c1, int c2, boolean init)
1965        {
1966            textureCombineAlphaSource[0] = c0;
1967            textureCombineAlphaSource[1] = c1;
1968            textureCombineAlphaSource[2] = c2;
1969    
1970            if(init)
1971                {
1972                    textureCombineAlphaSourceInit[0] = c0;
1973                    textureCombineAlphaSourceInit[1] = c1;
1974                    textureCombineAlphaSourceInit[2] = c2;                          
1975                    getPickerPan().setTextureCombineAlphaSource(textureCombineAlphaSource);                     
1976                }   
1977            else
1978                {
1979                    getPickerPan().setTextureCombineAlphaSource(textureCombineAlphaSource);  
1980                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_SOURCE,textureCombineAlphaSourceInit,textureCombineAlphaSource);              
1981                }
1982        }
1983    
1984        /**
1985         * 
1986         * Internal update of the Texture Combine Alpha Source Parameters and fire of an associated property.
1987         * @param s the Texture Combine Alpha Source (C0,C1,C2) between TextureAttributes.COMBINE_OBJECT_COLOR, 
1988         * TextureAttributes.COMBINE_TEXTURE_COLOR, TextureAttributes.COMBINE_CONSTANT_COLOR, 
1989         * TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE.
1990         *
1991         */    
1992        private void updateTextureCombineAlphaSource(int[] s)
1993        {
1994            int []lastTextureCombineAlphaSource = textureCombineAlphaSource;
1995            textureCombineAlphaSource = s;
1996            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_SOURCE,
1997                                            lastTextureCombineAlphaSource,
1998                                            textureCombineAlphaSource);
1999        }
2000    
2001        /**
2002         * 
2003         * Return the Texture Combine Alpha Function.
2004         * @return the Texture Combine Alpha Function between TextureAttributes.COMBINE_SRC_ALPHA, 
2005         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
2006         *
2007         */    
2008        public int[] getTextureCombineAlphaFunction()
2009        {
2010            return getPickerPan().getTextureCombineAlphaFunction();
2011        }
2012    
2013        /**
2014         * 
2015         * Set the Texture Combine Alpha Function.
2016         * @param c0 the Texture Combine Alpha Function C0 between TextureAttributes.COMBINE_SRC_ALPHA, 
2017         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
2018         * @param c1 the Texture Combine Alpha Function C1 between TextureAttributes.COMBINE_SRC_ALPHA, 
2019         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
2020         * @param c2 the Texture Combine Alpha Function C2 between TextureAttributes.COMBINE_SRC_ALPHA, 
2021         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
2022         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
2023         *
2024         */    
2025        public void setTextureCombineAlphaFunction(int c0, int c1, int c2, boolean init)
2026        {
2027            textureCombineAlphaFunction[0] = c0;
2028            textureCombineAlphaFunction[1] = c1;
2029            textureCombineAlphaFunction[2] = c2;
2030    
2031            if(init)
2032                {
2033                    textureCombineAlphaFunctionInit[0] = c0;
2034                    textureCombineAlphaFunctionInit[1] = c1;
2035                    textureCombineAlphaFunctionInit[2] = c2;                
2036                    getPickerPan().setTextureCombineAlphaFunction(textureCombineAlphaFunction);                 
2037                }   
2038            else
2039                {
2040                    getPickerPan().setTextureCombineAlphaFunction(textureCombineAlphaFunction);                 
2041                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_FUNCTION,textureCombineAlphaFunctionInit,textureCombineAlphaFunction);
2042                }
2043        }
2044    
2045        /**
2046         * 
2047         * Internal update of the Texture Combine Alpha Function Parameters and fire of an associated property.
2048         * @param s the Texture Combine Alpha Function (C0,C1,C2) between TextureAttributes.COMBINE_SRC_ALPHA, 
2049         * TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA.
2050         *
2051         */    
2052        private void updateTextureCombineAlphaFunction(int[] s)
2053        {
2054            int []lastTextureCombineAlphaFunction = textureCombineAlphaFunction;
2055            textureCombineAlphaFunction = s;
2056            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_FUNCTION,
2057                                            lastTextureCombineAlphaFunction,
2058                                            textureCombineAlphaFunction);
2059        }
2060    
2061        /**
2062         * 
2063         * Return the Texture Combine Alpha Scale.
2064         * @return the Texture Combine Alpha Scale.
2065         *
2066         */  
2067        public int getTextureCombineAlphaScale()
2068        {
2069            return getPickerPan().getTextureCombineAlphaScale();
2070        }
2071    
2072        /**
2073         * 
2074         * Set the Texture Combine Alpha Scale .
2075         * @param s the Texture Combine Alpha Scale.
2076         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
2077         *
2078         */  
2079        public void setTextureCombineAlphaScale(int s, boolean init)
2080        {
2081            textureCombineAlphaScale = s;
2082    
2083            if(init)
2084                {
2085                    textureCombineAlphaScaleInit = s;      
2086                    getPickerPan().setTextureCombineAlphaScale(s);              
2087                }
2088            else
2089                {
2090                    getPickerPan().setTextureCombineAlphaScale(s);              
2091                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_SCALE,textureCombineAlphaScaleInit,textureCombineAlphaScale);
2092                }
2093        }
2094    
2095        /**
2096         * 
2097         * Internal update of the Texture Combine Alpha Scale Parameters and fire of an associated property.
2098         * @param s the Texture Combine Alpha Scale.
2099         *
2100         */  
2101        private void updateTextureCombineAlphaScale(int s)
2102        {
2103            int lastTextureCombineAlphaScale = textureCombineAlphaScale;
2104            textureCombineAlphaScale = s;
2105            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_COMBINE_ALPHA_SCALE,
2106                                            lastTextureCombineAlphaScale,
2107                                            textureCombineAlphaScale);
2108        }
2109    
2110        /**
2111         * 
2112         * Return the Texture Setting.
2113         * @return true if the texture is used, false otherwise.
2114         *
2115         */  
2116        public boolean isTextureSet()
2117        {
2118            return getPickerPan().isTextureSet();
2119        }
2120    
2121        /**
2122         * 
2123         * Set the Texture Setting.
2124         * @param b true if the texture is used, false otherwise.
2125         * @param init set to true if it replaces the init value. Ie the CANCEL button will set it to this value.
2126         *
2127         */  
2128        public void setTextureUse(boolean b, boolean init)
2129        {
2130            textureUse = b;
2131    
2132            if(init)
2133                {
2134                    textureUseInit = b;                     
2135                    getPickerPan().setTextureUse(b);                    
2136                }
2137            else
2138                {
2139                    getPickerPan().setTextureUse(b);                    
2140                    boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_USE,textureUseInit,textureUse);
2141                }
2142        }
2143    
2144        /**
2145         * 
2146         * Internal update of the Texture Setting Parameters and fire of an associated property.
2147         * @param b true if the texture is used, false otherwise.
2148         *
2149         */  
2150        private void updateTextureUse(boolean b)
2151        {   
2152            boolean lastTextureUse = textureUse;
2153            textureUse = b;
2154            boundSupport.firePropertyChange(Appearance3DChooser.TEXTURE_USE,lastTextureUse,textureUse);
2155        }
2156        
2157        
2158        /**
2159         * 
2160         * A Main Exemple.
2161         *
2162         */  
2163        public static void main ( String args[] )
2164        {   
2165            /////////// Basic Exemple
2166    
2167            final Appearance3DChooser m1 = new Appearance3DChooser("test1", true, true, true, true);
2168            m1.runListeners();
2169            m1.addPropertyChangeListener(Appearance3DChooser.SPECULAR, new PropertyChangeListener() {
2170                    public void propertyChange(PropertyChangeEvent evt) {                              
2171                        System.out.println("SPECULAR : (" + m1.getSpecularColor()[0]+ "," 
2172                                           + m1.getSpecularColor()[1]+ "," 
2173                                           + m1.getSpecularColor()[2]+")");
2174                    }});
2175                    
2176            m1.addPropertyChangeListener(Appearance3DChooser.AMBIENT, new PropertyChangeListener() {
2177                    public void propertyChange(PropertyChangeEvent evt) {
2178                        System.out.println("AMBIENT : (" + m1.getAmbientColor()[0]+ "," 
2179                                           + m1.getAmbientColor()[1] + "," 
2180                                           + m1.getAmbientColor()[2]+")");              
2181                    }});
2182            
2183            m1.addPropertyChangeListener(Appearance3DChooser.EMISSIVE, new PropertyChangeListener() {
2184                    public void propertyChange(PropertyChangeEvent evt) {
2185                        System.out.println("EMISSIVE : (" + m1.getEmissiveColor()[0]+ "," 
2186                                           + m1.getEmissiveColor()[1] + "," 
2187                                           + m1.getEmissiveColor()[2]+")");
2188                    }});
2189            
2190            m1.addPropertyChangeListener(Appearance3DChooser.DIFFUSE, new PropertyChangeListener() {
2191                    public void propertyChange(PropertyChangeEvent evt) {
2192                        System.out.println("DIFFUSE : (" + m1.getDiffuseColor()[0] + "," 
2193                                           + m1.getDiffuseColor()[1] + "," 
2194                                           + m1.getDiffuseColor()[2]+")");
2195                    }});       
2196                    
2197            m1.addPropertyChangeListener(Appearance3DChooser.COLORTARGET, new PropertyChangeListener() {
2198                    public void propertyChange(PropertyChangeEvent evt) {
2199                        System.out.println("COLORTARGET : (" + m1.getColorTarget() +")");
2200                    }});        
2201            
2202            m1.addPropertyChangeListener(Appearance3DChooser.SHININESS, new PropertyChangeListener() {
2203                    public void propertyChange(PropertyChangeEvent evt) {
2204                        System.out.println("SHININESS : (" + m1.getShininess() + ")");
2205                    }});
2206            
2207            m1.addPropertyChangeListener(Appearance3DChooser.LIGHTING, new PropertyChangeListener() {
2208                    public void propertyChange(PropertyChangeEvent evt) {
2209                        System.out.println("LIGHTING : (" + m1.getLighting() +")");
2210                    }});
2211    
2212            m1.addPropertyChangeListener(Appearance3DChooser.TRANSPARENCY, new PropertyChangeListener() {
2213                    public void propertyChange(PropertyChangeEvent evt) {
2214                        System.out.println("TRANSPARENCY : (" + m1.getTransparency() +")");
2215                    }});
2216    
2217            m1.addPropertyChangeListener(Appearance3DChooser.TRANSPARENCY_MODE, new PropertyChangeListener() {
2218                    public void propertyChange(PropertyChangeEvent evt) {
2219                        System.out.println("TRANSPARENCY_MODE : (" + m1.getTransparencyMode() +")");
2220                    }});
2221    
2222            m1.addPropertyChangeListener(Appearance3DChooser.TRANSPARENCY_SRC_BLEND_FUNCTION, new PropertyChangeListener() {
2223                    public void propertyChange(PropertyChangeEvent evt) {
2224                        System.out.println("TRANSPARENCY_SRC_BLEND_FUNCTION : (" + m1.getTransparencySrcBlendFunction() +")");
2225                    }});
2226    
2227            m1.addPropertyChangeListener(Appearance3DChooser.TRANSPARENCY_DST_BLEND_FUNCTION, new PropertyChangeListener() {
2228                    public void propertyChange(PropertyChangeEvent evt) {
2229                        System.out.println("TRANSPARENCY_DST_BLEND_FUNCTION : (" + m1.getTransparencyDstBlendFunction() +")");
2230                    }});
2231    
2232            m1.addPropertyChangeListener(Appearance3DChooser.TEXTURE_USE, new PropertyChangeListener() {
2233                    public void propertyChange(PropertyChangeEvent evt) {
2234                        System.out.println("TEXTURE_USE : (" + m1.isTextureSet() +")");
2235                    }});
2236    
2237            m1.addPropertyChangeListener(Appearance3DChooser.TEXTURE_FILE, new PropertyChangeListener() {
2238                    public void propertyChange(PropertyChangeEvent evt) {
2239                        System.out.println("TEXTURE_FILE : (" + m1.getTextureFile() +")");
2240                    }});
2241    
2242            m1.addPropertyChangeListener(Appearance3DChooser.TEXTURE_TRANSFORM, new PropertyChangeListener() {
2243                    public void propertyChange(PropertyChangeEvent evt) {
2244                        System.out.println("\nTEXTURE_TRANSFORM2 : \n" + m1.getTextureTransform() );
2245                        System.out.println("Scale : x=" + m1.getTextureTransformScaleX() + ", y=" +m1.getTextureTransformScaleY());
2246                        System.out.println("Translation : x=" + m1.getTextureTransformTranslatX() + ", y=" +m1.getTextureTransformTranslatY());
2247                        System.out.println("Rotation : z=" + m1.getTextureTransformRotZ());             
2248                    }});
2249    
2250            m1.addPropertyChangeListener(Appearance3DChooser.TEXTURE_PERSPECTIVE_CORRECTION_MODE, new PropertyChangeListener() {
2251                    public void propertyChange(PropertyChangeEvent evt) {
2252                        System.out.println("TEXTURE_PERSPECTIVE_CORRECTION_MODE : (" + m1.getTexturePerspectiveCorrectionMode() +")");
2253                    }});
2254    
2255            m1.addPropertyChangeListener(Appearance3DChooser.TEXTURE_MODE, new PropertyChangeListener() {
2256                    public void propertyChange(PropertyChangeEvent evt) {
2257                        System.out.println("TEXTURE_MODE : (" + m1.getTextureMode() +")");
2258                    }});
2259    
2260            m1.addPropertyChangeListener(Appearance3DChooser.TEXTURE_BLEND, new PropertyChangeListener() {
2261                    public void propertyChange(PropertyChangeEvent evt) {
2262                        System.out.println("TEXTURE_BLEND : (" + 
2263                                           m1.getTextureBlendColor()[0] + "," +
2264                                           m1.getTextureBlendColor()[1] + "," +
2265                                           m1.getTextureBlendColor()[2] + "," +
2266                                           m1.getTextureBlendColor()[3] 
2267                                           + ")");
2268                    }});
2269            
2270            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_MODE, new PropertyChangeListener() {
2271                    public void propertyChange(PropertyChangeEvent evt) {
2272                        System.out.println("TEXTURE_COMBINE_RGB_MODE : (" + m1.getTextureCombineRGBMode() +")");
2273                    }});
2274            
2275            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SOURCE, new PropertyChangeListener() {
2276                    public void propertyChange(PropertyChangeEvent evt) {
2277                        System.out.println("TEXTURE_COMBINE_RGB_SOURCE : (" + 
2278                                           m1.getTextureCombineRGBSource()[0]+"," +
2279                                           m1.getTextureCombineRGBSource()[1]+"," +
2280                                           m1.getTextureCombineRGBSource()[2] 
2281                                           + ")");
2282                    }});
2283    
2284            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_FUNCTION, new PropertyChangeListener() {
2285                    public void propertyChange(PropertyChangeEvent evt) {
2286                        System.out.println("TEXTURE_COMBINE_RGB_FUNCTION : (" + 
2287                                           m1.getTextureCombineRGBFunction()[0]+"," +
2288                                           m1.getTextureCombineRGBFunction()[1]+"," +
2289                                           m1.getTextureCombineRGBFunction()[2] 
2290                                           + ")");
2291                    }});
2292    
2293            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SCALE, new PropertyChangeListener() {
2294                    public void propertyChange(PropertyChangeEvent evt) {
2295                        System.out.println("TEXTURE_COMBINE_RGB_SCALE : (" + m1.getTextureCombineRGBScale() +")");
2296                    }});
2297    
2298            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_MODE, new PropertyChangeListener() {
2299                    public void propertyChange(PropertyChangeEvent evt) {
2300                        System.out.println("TEXTURE_COMBINE_ALPHA_MODE : (" + m1.getTextureCombineAlphaMode() +")");
2301                    }});
2302            
2303            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SOURCE, new PropertyChangeListener() {
2304                    public void propertyChange(PropertyChangeEvent evt) {
2305                        System.out.println("TEXTURE_COMBINE_ALPHA_SOURCE : (" + 
2306                                           m1.getTextureCombineAlphaSource()[0] + "," +
2307                                           m1.getTextureCombineAlphaSource()[1] + "," +
2308                                           m1.getTextureCombineAlphaSource()[2] 
2309                                           + ")");              
2310                    }});
2311            
2312            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_FUNCTION, new PropertyChangeListener() {
2313                    public void propertyChange(PropertyChangeEvent evt) {
2314                        System.out.println("TEXTURE_COMBINE_ALPHA_FUNCTION : (" + 
2315                                           m1.getTextureCombineAlphaFunction()[0] + "," +
2316                                           m1.getTextureCombineAlphaFunction()[1] + "," +
2317                                           m1.getTextureCombineAlphaFunction()[2] 
2318                                           + ")");              
2319                    }});
2320            
2321            m1.addPropertyChangeListener(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SCALE, new PropertyChangeListener() {
2322                    public void propertyChange(PropertyChangeEvent evt) {
2323                        System.out.println("TEXTURE_COMBINE_ALPHA_SCALE : (" + m1.getTextureCombineAlphaScale() +")");
2324                    }});
2325            
2326    
2327    
2328            /////////// A more realistic Exemple
2329    
2330            final Appearance3DChooser m2 = new Appearance3DChooser("test2", true, true, true, true);
2331            m2.runListeners();
2332            m2.addPropertyChangeListener(new PropertyChangeListener() {
2333                    public void propertyChange(PropertyChangeEvent evt) 
2334                    {
2335                        if (evt.getPropertyName().compareTo(Appearance3DChooser.SPECULAR) == 0)
2336                            {
2337                                System.out.println("SPECULAR2 : (" + m2.getSpecularColor()[0]+ "," 
2338                                                   + m2.getSpecularColor()[1]+ "," 
2339                                                   + m2.getSpecularColor()[2]+")");
2340                            }
2341                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.AMBIENT) == 0)
2342                            {
2343                                System.out.println("AMBIENT2 : (" + m2.getAmbientColor()[0]+ "," 
2344                                                   + m2.getAmbientColor()[1] + "," 
2345                                                   + m2.getAmbientColor()[2]+")");              
2346                            }
2347                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.EMISSIVE) == 0)
2348                            {
2349                                System.out.println("EMISSIVE2 : (" + m2.getEmissiveColor()[0]+ "," 
2350                                                   + m2.getEmissiveColor()[1] + "," 
2351                                                   + m2.getEmissiveColor()[2]+")");
2352                            }
2353                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.DIFFUSE) == 0)
2354                            {
2355                                System.out.println("DIFFUSE2 : (" + m2.getDiffuseColor()[0] + "," 
2356                                                   + m2.getDiffuseColor()[1] + "," 
2357                                                   + m2.getDiffuseColor()[2]+")");
2358                            }
2359                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.COLORTARGET) == 0)
2360                            {
2361                                System.out.println("COLORTARGET2 : (" + m2.getColorTarget() +")");
2362                            }
2363                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.SHININESS) == 0)
2364                            {
2365                                System.out.println("SHININESS2 : (" + m2.getShininess() + ")");
2366                            }
2367                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.LIGHTING) == 0)
2368                            {
2369                                System.out.println("LIGHTING2 : (" + m2.getLighting() +")");
2370                            }
2371                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY) == 0)
2372                            {
2373                                System.out.println("TRANSPARENCY2 : (" + m2.getTransparency() +")");
2374                            }
2375                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY_MODE) == 0)
2376                            {
2377                                System.out.println("TRANSPARENCY_MODE2 : (" + m2.getTransparencyMode() +")");
2378                            }
2379                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY_SRC_BLEND_FUNCTION) == 0)
2380                            {
2381                                System.out.println("TRANSPARENCY_SRC_BLEND_FUNCTION2 : (" + m2.getTransparencySrcBlendFunction() +")");
2382                            }
2383                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TRANSPARENCY_DST_BLEND_FUNCTION) == 0)
2384                            {
2385                                System.out.println("TRANSPARENCY_DST_BLEND_FUNCTION2 : (" + m2.getTransparencyDstBlendFunction() +")");
2386                            }
2387                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_USE) == 0)
2388                            {
2389                                System.out.println("TEXTURE_USE2 : (" + m2.isTextureSet() +")");
2390                            }
2391                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_FILE) == 0)
2392                            {
2393                                System.out.println("TEXTURE_FILE2 : (" + m2.getTextureFile() +")");
2394                            }
2395                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_TRANSFORM) == 0)
2396                            {
2397                                System.out.println("\nTEXTURE_TRANSFORM2 : \n" + m2.getTextureTransform() );
2398                                System.out.println("Rotation : z=" + m2.getTextureTransformRotZ()); 
2399                                System.out.println("Scale : x=" + m2.getTextureTransformScaleX() + ", y=" +m2.getTextureTransformScaleY());
2400                                System.out.println("Translation : x=" + m2.getTextureTransformTranslatX() + ", y=" +m2.getTextureTransformTranslatY());                         
2401                            }
2402                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_PERSPECTIVE_CORRECTION_MODE) == 0)
2403                            {
2404                                System.out.println("TEXTURE_PERSPECTIVE_CORRECTION_MODE2 : (" + m2.getTexturePerspectiveCorrectionMode() +")");
2405                            }
2406                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_MODE) == 0)
2407                            {
2408                                System.out.println("TEXTURE_MODE2 : (" + m2.getTextureMode() +")");
2409                            }
2410                        else if (evt.getPropertyName().compareTo(Appearance3DChooser.TEXTURE_BLEND) == 0)
2411                            {
2412                                System.out.println("TEXTURE_BLEND2 : (" + 
2413                                                   m2.getTextureBlendColor()[0] + "," +
2414                                                   m2.getTextureBlendColor()[1] + "," +
2415                                                   m2.getTextureBlendColor()[2] + "," +
2416                                                   m2.getTextureBlendColor()[3] 
2417                                                   + ")");
2418                            }
2419                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_MODE) == 0)
2420                            {
2421                                System.out.println("TEXTURE_COMBINE_RGB_MODE2 : (" + m2.getTextureCombineRGBMode() +")");
2422                            }
2423                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SOURCE) == 0)
2424                            {
2425                                System.out.println("TEXTURE_COMBINE_RGB_SOURCE2 : (" + 
2426                                                   m2.getTextureCombineRGBSource()[0] + "," +
2427                                                   m2.getTextureCombineRGBSource()[1] + "," +
2428                                                   m2.getTextureCombineRGBSource()[2] 
2429                                                   + ")");
2430                            }
2431                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_FUNCTION) == 0)
2432                            {
2433                                System.out.println("TEXTURE_COMBINE_RGB_FUNCTION2 : (" + 
2434                                                   m2.getTextureCombineRGBFunction()[0] + "," +
2435                                                   m2.getTextureCombineRGBFunction()[1] + "," +
2436                                                   m2.getTextureCombineRGBFunction()[2] 
2437                                                   + ")");
2438                            }
2439                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_RGB_SCALE) == 0)
2440                            {
2441                                System.out.println("TEXTURE_COMBINE_RGB_SCALE2 : (" + m2.getTextureCombineRGBScale() +")");
2442                            }
2443                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_MODE) == 0)
2444                            {
2445                                System.out.println("TEXTURE_COMBINE_ALPHA_MODE2 : (" + m2.getTextureCombineAlphaMode() +")");
2446                            }
2447                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SOURCE) == 0)
2448                            {
2449                                System.out.println("TEXTURE_COMBINE_ALPHA_SOURCE2 : (" + 
2450                                                   m2.getTextureCombineAlphaSource()[0] + "," +
2451                                                   m2.getTextureCombineAlphaSource()[1] + "," +
2452                                                   m2.getTextureCombineAlphaSource()[2]
2453                                                   + ")");
2454                            }                   
2455                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_FUNCTION) == 0)
2456                            {
2457                                System.out.println("TEXTURE_COMBINE_ALPHA_FUNCTION2 : (" + 
2458                                                   m2.getTextureCombineAlphaFunction()[0] + "," +
2459                                                   m2.getTextureCombineAlphaFunction()[1] + "," +
2460                                                   m2.getTextureCombineAlphaFunction()[2]
2461                                                   + ")");
2462                            }
2463                        else if (evt.getPropertyName().compareTo(Appearance3DChooserPanel.TEXTURE_COMBINE_ALPHA_SCALE) == 0)
2464                            {
2465                                System.out.println("TEXTURE_COMBINE_ALPHA_SCALE2 : (" + m2.getTextureCombineAlphaScale() +")");
2466                            }                   
2467                                       
2468                    }});
2469    
2470    
2471            // Test Initialisation
2472    
2473            float []emissiveColor = {1.0f,0.9f,0.8f};
2474            float []ambientColor = {0.7f,0.6f,0.5f};
2475            float []diffuseColor = {0.4f,0.3f,0.2f};
2476            float []specularColor = {0.1f,0.0f,1.0f};
2477            boolean lighting = false;
2478            float shininess = 85.0f;
2479            int colorTarget = Material.SPECULAR;
2480            float transparency = 0.5f;
2481            int transparencyMode = TransparencyAttributes.SCREEN_DOOR;
2482            int transparencySrcBlendFunction = TransparencyAttributes.BLEND_ONE;
2483            int transparencyDstBlendFunction = TransparencyAttributes.BLEND_SRC_ALPHA;
2484            Transform3D textureTransform = new Transform3D(); //////////////////////
2485            boolean textureUse = true;
2486            URL textureFile = (new Info()).getClass().getResource("resources/TexturePanel-2.png"); 
2487            int texturePerspectiveCorrectionMode = TextureAttributes.FASTEST;
2488            int textureMode = TextureAttributes.REPLACE;
2489            float []textureBlendColor = {0.1f,0.2f,0.3f,0.4f};
2490            int textureCombineRGBMode = TextureAttributes.COMBINE_INTERPOLATE;
2491            int []textureCombineRGBSource = {TextureAttributes.COMBINE_OBJECT_COLOR, 
2492                                             TextureAttributes.COMBINE_CONSTANT_COLOR, 
2493                                             TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE};
2494            int []textureCombineRGBFunction = {TextureAttributes.COMBINE_SRC_ALPHA, 
2495                                               TextureAttributes.COMBINE_ONE_MINUS_SRC_COLOR, 
2496                                               TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA};
2497            int textureCombineRGBScale = 2;
2498            int textureCombineAlphaMode = TextureAttributes.COMBINE_DOT3;
2499            int []textureCombineAlphaSource = {TextureAttributes.COMBINE_PREVIOUS_TEXTURE_UNIT_STATE, 
2500                                               TextureAttributes.COMBINE_TEXTURE_COLOR, 
2501                                               TextureAttributes.COMBINE_OBJECT_COLOR};
2502            int []textureCombineAlphaFunction = {TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA, 
2503                                                 TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA, 
2504                                                 TextureAttributes.COMBINE_ONE_MINUS_SRC_ALPHA};
2505            int textureCombineAlphaScale = 4;        
2506    
2507    
2508            // Set init Value
2509            
2510            m2.setAmbientColor(ambientColor[0],ambientColor[1],ambientColor[2], true);
2511            m2.setDiffuseColor(diffuseColor[0],diffuseColor[1],diffuseColor[2], true); 
2512            m2.setEmissiveColor(emissiveColor[0],emissiveColor[1],emissiveColor[2], true);  
2513            m2.setSpecularColor(specularColor[0],specularColor[1],specularColor[2], true);
2514            m2.setShininess(shininess, true);
2515            m2.setColorTarget(colorTarget, true);      
2516            m2.setLighting(lighting, true);
2517            m2.setTransparency(transparency, true);
2518            m2.setTransparencyMode(transparencyMode, true);
2519            m2.setTransparencySrcBlendFunction(transparencySrcBlendFunction, true);
2520            m2.setTransparencyDstBlendFunction(transparencyDstBlendFunction, true);
2521            m2.setTextureUse(textureUse, true);
2522            m2.setTextureTransform(textureTransform, true); 
2523            m2.setTextureTransformScaleX(4,true);
2524            m2.setTextureTransformScaleY(2,true);
2525            m2.setTextureTransformTranslatX(0.5f,true);
2526            m2.setTextureTransformTranslatY(1,true);
2527            m2.setTextureTransformRotZ(1.67f,true);
2528            m2.setTextureFile(textureFile, true);                   
2529            m2.setTexturePerspectiveCorrectionMode(texturePerspectiveCorrectionMode, true);
2530            m2.setTextureMode(textureMode, true);
2531            m2.setTextureBlendColor(textureBlendColor[0],textureBlendColor[1],textureBlendColor[2],textureBlendColor[3], true);         
2532            m2.setTextureCombineRGBMode(textureCombineRGBMode, true);
2533            m2.setTextureCombineRGBSource(textureCombineRGBSource[0],textureCombineRGBSource[1],textureCombineRGBSource[2], true);
2534            m2.setTextureCombineRGBFunction(textureCombineRGBFunction[0],textureCombineRGBFunction[1],textureCombineRGBFunction[2], true);
2535            m2.setTextureCombineRGBScale(textureCombineRGBScale, true);     
2536            m2.setTextureCombineAlphaMode(textureCombineAlphaMode, true);
2537            m2.setTextureCombineAlphaSource(textureCombineAlphaSource[0],textureCombineAlphaSource[1],textureCombineAlphaSource[2], true);
2538            m2.setTextureCombineAlphaFunction(textureCombineAlphaFunction[0],textureCombineAlphaFunction[1],textureCombineAlphaFunction[2], true);
2539            m2.setTextureCombineAlphaScale(textureCombineAlphaScale, true); 
2540            
2541    
2542            // Set new values that are not the default ones ... ie Cancel button will unset them
2543            /*
2544              m2.setAmbientColor(ambientColor[0],ambientColor[1],ambientColor[2], false);
2545              m2.setDiffuseColor(diffuseColor[0],diffuseColor[1],diffuseColor[2], false); 
2546              m2.setEmissiveColor(emissiveColor[0],emissiveColor[1],emissiveColor[2], false);  
2547              m2.setSpecularColor(specularColor[0],specularColor[1],specularColor[2], false);
2548              m2.setShininess(shininess, false);
2549              m2.setColorTarget(colorTarget, false);      
2550              m2.setLighting(lighting, false);
2551              m2.setTransparency(transparency, false);
2552              m2.setTransparencyMode(transparencyMode, false);
2553              m2.setTransparencySrcBlendFunction(transparencySrcBlendFunction, false);
2554              m2.setTransparencyDstBlendFunction(transparencyDstBlendFunction, false);
2555              m2.setTextureUse(textureUse, false);
2556              m2.setTextureTransform(textureTransform, false);              
2557              m2.setTextureTransformRotZ(2.674f,false);
2558              m2.setTextureTransformScaleX(4,false);
2559              m2.setTextureTransformScaleY(2,false);
2560              m2.setTextureTransformTranslatX(0.5f,false);
2561              m2.setTextureTransformTranslatY(1,false);
2562              m2.setTextureFile(textureFile, false);                        
2563              m2.setTexturePerspectiveCorrectionMode(texturePerspectiveCorrectionMode, false);
2564              m2.setTextureMode(textureMode, false);
2565              m2.setTextureBlendColor(textureBlendColor[0],textureBlendColor[1],textureBlendColor[2],textureBlendColor[3], false);      
2566              m2.setTextureCombineRGBMode(textureCombineRGBMode, false);
2567              m2.setTextureCombineRGBSource(textureCombineRGBSource[0],textureCombineRGBSource[1],textureCombineRGBSource[2], false);
2568              m2.setTextureCombineRGBFunction(textureCombineRGBFunction[0],textureCombineRGBFunction[1],textureCombineRGBFunction[2], false);
2569              m2.setTextureCombineRGBScale(textureCombineRGBScale, false);  
2570              m2.setTextureCombineAlphaMode(textureCombineAlphaMode, false);
2571              m2.setTextureCombineAlphaSource(textureCombineAlphaSource[0],textureCombineAlphaSource[1],textureCombineAlphaSource[2], false);
2572              m2.setTextureCombineAlphaFunction(textureCombineAlphaFunction[0],textureCombineAlphaFunction[1],textureCombineAlphaFunction[2], false);
2573              m2.setTextureCombineAlphaScale(textureCombineAlphaScale, false);      
2574            */
2575    
2576    
2577    
2578    
2579            while(true)
2580                {           
2581                    try{              
2582                        Thread.currentThread().sleep(60000); //sleep for 60000 ms               
2583                    }
2584                    catch(Exception ie){
2585                        //If this thread was interrupted by nother thread 
2586                    }
2587                    
2588                    if(!m1.isVisible() && !m2.isVisible())
2589                        System.exit(0);
2590                }           
2591        }
2592        
2593    }