00001 package gui.Widgets;
00002
00003
00004 import gui.OpenGL.TestRenderer;
00005
00006 import java.awt.GridBagConstraints;
00007 import java.awt.GridBagLayout;
00008 import java.awt.event.ItemEvent;
00009 import java.awt.event.ItemListener;
00010
00011 import javax.media.opengl.GLCanvas;
00012 import javax.swing.JCheckBox;
00013 import javax.swing.JPanel;
00014
00015 import commandline.debuggingCode.Debug;
00016
00017
00018
00025 public class OpenGLSettingsPanel extends JPanel implements ItemListener {
00026
00027 GridBagLayout gridBagLayout;
00028 GridBagConstraints gridBagConstraints;
00029 OpenGLButton meshViewOpenGLButton, show_ZOpenGLButton,show_axisButton;
00030 JCheckBox OrthographicsButton;
00031 TestRenderer renderer;
00032 GLCanvas canvas;
00033 public OpenGLSettingsPanel(TestRenderer renderer, GLCanvas canvas) {
00034
00035 this.renderer=renderer;
00036 this.canvas=canvas;
00037 meshViewOpenGLButton=new OpenGLButton(renderer,TestRenderer.MESHVIEW,"meshgrid",canvas);
00038 show_ZOpenGLButton=new OpenGLButton(renderer,TestRenderer.SHOW_3D,"show 3D",canvas);
00039 show_axisButton=new OpenGLButton(renderer,TestRenderer.SHOW_AXIS,"show axis",canvas);
00040
00041
00042
00043
00044 gridBagLayout = new GridBagLayout();
00045 gridBagConstraints = new GridBagConstraints();
00046 gridBagConstraints.fill = GridBagConstraints.BOTH;
00047 this.setLayout(gridBagLayout);
00048
00049 gridBagLayout.setConstraints(meshViewOpenGLButton,gridBagConstraints);
00050 this.add(meshViewOpenGLButton);
00051 gridBagLayout.setConstraints(show_ZOpenGLButton,gridBagConstraints);
00052 this.add(show_ZOpenGLButton);
00053 gridBagLayout.setConstraints(show_axisButton,gridBagConstraints);
00054 this.add(show_axisButton);
00055
00056
00057 }
00058
00059
00060 public void itemStateChanged(ItemEvent itemEvent){
00061 Object source=itemEvent.getSource();
00062 if(source==OrthographicsButton){
00063 Debug.print("OrthographicsButton.isSelected()= " + OrthographicsButton.isSelected());
00064 renderer.getCamera().setOrthograpics(OrthographicsButton.isSelected());
00065 canvas.repaint();
00066 }
00067
00068 }
00069
00070
00071 }