public void setDemo(String demo) { setTitle("Jogl Demo: " + demo); if (animator == null) { animator = new Animator(); animator.setIgnoreExceptions(true); } // stop(); if (drawable != null) { gradientPanel.remove(drawable); animator.remove(drawable); drawable = null; } if (demo.equals("gears")) { drawable = new JGears(); type = GEARS; } // else if(demo.equals("graphics")){ // type=GRAPHICS; // drawable=new JGLGraphics(); // } if (drawable != null) { gradientPanel.add(drawable, BorderLayout.CENTER); animator.add(drawable); } }
public void propertyChange(PropertyChangeEvent evt) { if (DisplayOptions.isUpdateUIEvent(evt)) { SwingUtilities.updateComponentTreeUI(this); gradientPanel.remove(drawable); JPanel newpanel = createGradientPanel(); contentPane.remove(gradientPanel); gradientPanel = newpanel; gradientPanel.add(drawable, BorderLayout.CENTER); contentPane.add(gradientPanel, BorderLayout.CENTER); } }