1 package net.sf.openrocket.gui.configdialog;
4 import javax.swing.JComboBox;
5 import javax.swing.JLabel;
6 import javax.swing.JPanel;
7 import javax.swing.JSeparator;
8 import javax.swing.JSpinner;
9 import javax.swing.SwingConstants;
11 import net.miginfocom.swing.MigLayout;
12 import net.sf.openrocket.gui.SpinnerEditor;
13 import net.sf.openrocket.gui.adaptors.DoubleModel;
14 import net.sf.openrocket.gui.adaptors.EnumModel;
15 import net.sf.openrocket.gui.adaptors.IntegerModel;
16 import net.sf.openrocket.gui.components.BasicSlider;
17 import net.sf.openrocket.gui.components.UnitSelector;
18 import net.sf.openrocket.material.Material;
19 import net.sf.openrocket.rocketcomponent.FinSet;
20 import net.sf.openrocket.rocketcomponent.RocketComponent;
21 import net.sf.openrocket.unit.UnitGroup;
23 public class EllipticalFinSetConfig extends FinSetConfig {
25 public EllipticalFinSetConfig(final RocketComponent component) {
32 JPanel mainPanel = new JPanel(new MigLayout());
36 JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
39 panel.add(new JLabel("Number of fins:"));
41 IntegerModel im = new IntegerModel(component,"FinCount",1,8);
43 spin = new JSpinner(im.getSpinnerModel());
44 spin.setEditor(new SpinnerEditor(spin));
45 panel.add(spin,"growx, wrap");
49 panel.add(new JLabel("Rotation:"));
51 m = new DoubleModel(component, "BaseRotation", UnitGroup.UNITS_ANGLE,-Math.PI,Math.PI);
53 spin = new JSpinner(m.getSpinnerModel());
54 spin.setEditor(new SpinnerEditor(spin));
55 panel.add(spin,"growx");
57 panel.add(new UnitSelector(m),"growx");
58 panel.add(new BasicSlider(m.getSliderModel(-Math.PI,Math.PI)),"w 100lp, wrap");
62 panel.add(new JLabel("Root chord:"));
64 m = new DoubleModel(component,"Length",UnitGroup.UNITS_LENGTH,0);
66 spin = new JSpinner(m.getSpinnerModel());
67 spin.setEditor(new SpinnerEditor(spin));
68 panel.add(spin,"growx");
70 panel.add(new UnitSelector(m),"growx");
71 panel.add(new BasicSlider(m.getSliderModel(0,0.05,0.2)),"w 100lp, wrap");
75 panel.add(new JLabel("Height:"));
77 m = new DoubleModel(component,"Height",UnitGroup.UNITS_LENGTH,0);
79 spin = new JSpinner(m.getSpinnerModel());
80 spin.setEditor(new SpinnerEditor(spin));
81 panel.add(spin,"growx");
83 panel.add(new UnitSelector(m),"growx");
84 panel.add(new BasicSlider(m.getSliderModel(0,0.05,0.2)),"w 100lp, wrap");
89 panel.add(new JLabel("Position relative to:"));
91 combo = new JComboBox(
92 new EnumModel<RocketComponent.Position>(component, "RelativePosition",
93 new RocketComponent.Position[] {
94 RocketComponent.Position.TOP,
95 RocketComponent.Position.MIDDLE,
96 RocketComponent.Position.BOTTOM,
97 RocketComponent.Position.ABSOLUTE
99 panel.add(combo,"spanx, growx, wrap");
101 panel.add(new JLabel("plus"),"right");
103 m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH);
104 spin = new JSpinner(m.getSpinnerModel());
105 spin.setEditor(new SpinnerEditor(spin));
106 panel.add(spin,"growx");
108 panel.add(new UnitSelector(m),"growx");
109 panel.add(new BasicSlider(m.getSliderModel(
110 new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
111 new DoubleModel(component.getParent(), "Length"))),
117 mainPanel.add(panel,"aligny 20%");
119 mainPanel.add(new JSeparator(SwingConstants.VERTICAL),"growy");
123 panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
127 panel.add(new JLabel("Fin cross section:"),"span, split");
128 combo = new JComboBox(
129 new EnumModel<FinSet.CrossSection>(component,"CrossSection"));
130 panel.add(combo,"growx, wrap unrel");
134 panel.add(new JLabel("Thickness:"));
136 m = new DoubleModel(component,"Thickness",UnitGroup.UNITS_LENGTH,0);
138 spin = new JSpinner(m.getSpinnerModel());
139 spin.setEditor(new SpinnerEditor(spin));
140 panel.add(spin,"growx");
142 panel.add(new UnitSelector(m),"growx");
143 panel.add(new BasicSlider(m.getSliderModel(0,0.01)),"w 100lp, wrap 30lp");
148 materialPanel(panel, Material.Type.BULK);
154 mainPanel.add(panel,"aligny 20%");
159 tabbedPane.insertTab("General", null, mainPanel, "General properties", 0);
160 tabbedPane.setSelectedIndex(0);