Home | History | Annotate | Download | only in flame
      1 package com.badlogic.gdx.tools.flame;
      2 
      3 import java.awt.GridBagConstraints;
      4 import java.awt.Insets;
      5 import java.awt.event.ActionEvent;
      6 import java.awt.event.ActionListener;
      7 
      8 import javax.swing.JCheckBox;
      9 import javax.swing.JLabel;
     10 import javax.swing.JPanel;
     11 
     12 /** @author Inferno */
     13 public class DrawPanel extends EditorPanel
     14 {
     15 	JCheckBox 	drawXYZCheckBox,
     16 				drawXZPlaneBox, drawXYPlaneBox;
     17 
     18 	public DrawPanel (FlameMain editor, String name, String description) {
     19 		super(editor, name, description);
     20 		setValue(null);
     21 	}
     22 
     23 	@Override
     24 	protected void initializeComponents () {
     25 		super.initializeComponents();
     26 		JPanel contentPanel = getContentPanel();
     27 
     28 		//XYZ
     29 		contentPanel.add(new JLabel("XYZ:"), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
     30 				new Insets(6, 0, 0, 0), 0, 0));
     31 		drawXYZCheckBox = new JCheckBox();
     32 		contentPanel.add(drawXYZCheckBox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
     33 				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
     34 
     35 		//XZ Plane
     36 		contentPanel.add(new JLabel("XZ Plane:"), new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
     37 				new Insets(6, 0, 0, 0), 0, 0));
     38 		drawXZPlaneBox = new JCheckBox();
     39 		contentPanel.add(drawXZPlaneBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST,
     40 				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
     41 
     42 		//XY Plane
     43 		contentPanel.add(new JLabel("XY Plane:"), new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
     44 				new Insets(6, 0, 0, 0), 0, 0));
     45 		drawXYPlaneBox = new JCheckBox();
     46 		contentPanel.add(drawXYPlaneBox, new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.WEST,
     47 				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
     48 
     49 		//Listeners
     50 		drawXYZCheckBox.addActionListener(new ActionListener() {
     51 			public void actionPerformed (ActionEvent event) {
     52 				DrawPanel.this.editor.getRenderer().setDrawXYZ(drawXYZCheckBox.isSelected());
     53 			}
     54 		});
     55 		drawXYZCheckBox.setSelected(editor.getRenderer().IsDrawXYZ());
     56 
     57 		drawXZPlaneBox.addActionListener(new ActionListener() {
     58 			public void actionPerformed (ActionEvent event) {
     59 				DrawPanel.this.editor.getRenderer().setDrawXZPlane(drawXZPlaneBox.isSelected());
     60 			}
     61 		});
     62 		drawXZPlaneBox.setSelected(editor.getRenderer().IsDrawXZPlane());
     63 
     64 		drawXYPlaneBox.addActionListener(new ActionListener() {
     65 			public void actionPerformed (ActionEvent event) {
     66 				DrawPanel.this.editor.getRenderer().setDrawXYPlane(drawXYPlaneBox.isSelected());
     67 			}
     68 		});
     69 	}
     70 }
     71