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.JSpinner;
9 import net.miginfocom.swing.MigLayout;
10 import net.sf.openrocket.gui.SpinnerEditor;
11 import net.sf.openrocket.gui.adaptors.DoubleModel;
12 import net.sf.openrocket.gui.adaptors.EnumModel;
13 import net.sf.openrocket.gui.components.BasicSlider;
14 import net.sf.openrocket.gui.components.UnitSelector;
15 import net.sf.openrocket.material.Material;
16 import net.sf.openrocket.rocketcomponent.RocketComponent;
17 import net.sf.openrocket.unit.UnitGroup;
19 public class ShockCordConfig extends RocketComponentConfig {
22 public ShockCordConfig(RocketComponent component) {
25 JPanel panel = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
35 label = new JLabel("Shock cord length");
38 m = new DoubleModel(component,"CordLength",UnitGroup.UNITS_LENGTH,0);
40 spin = new JSpinner(m.getSpinnerModel());
41 spin.setEditor(new SpinnerEditor(spin));
42 panel.add(spin,"growx");
44 panel.add(new UnitSelector(m),"growx");
45 panel.add(new BasicSlider(m.getSliderModel(0, 1, 10)),"w 100lp, wrap");
49 materialPanel(panel, Material.Type.LINE, "Shock cord material:", null);
54 JPanel panel2 = new JPanel(new MigLayout("gap rel unrel","[][65lp::][30lp::]",""));
55 panel.add(panel2, "cell 4 0, gapleft paragraph, aligny 0%, spany");
60 panel2.add(new JLabel("Position relative to:"));
62 JComboBox combo = new JComboBox(
63 new EnumModel<RocketComponent.Position>(component, "RelativePosition",
64 new RocketComponent.Position[] {
65 RocketComponent.Position.TOP,
66 RocketComponent.Position.MIDDLE,
67 RocketComponent.Position.BOTTOM,
68 RocketComponent.Position.ABSOLUTE
70 panel2.add(combo,"spanx, growx, wrap");
72 panel2.add(new JLabel("plus"),"right");
74 m = new DoubleModel(component,"PositionValue",UnitGroup.UNITS_LENGTH);
75 spin = new JSpinner(m.getSpinnerModel());
76 spin.setEditor(new SpinnerEditor(spin));
77 panel2.add(spin,"growx");
79 panel2.add(new UnitSelector(m),"growx");
80 panel2.add(new BasicSlider(m.getSliderModel(
81 new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
82 new DoubleModel(component.getParent(), "Length"))),
87 panel2.add(new JLabel("Packed length:"));
89 m = new DoubleModel(component,"Length",UnitGroup.UNITS_LENGTH,0);
91 spin = new JSpinner(m.getSpinnerModel());
92 spin.setEditor(new SpinnerEditor(spin));
93 panel2.add(spin,"growx");
95 panel2.add(new UnitSelector(m),"growx");
96 panel2.add(new BasicSlider(m.getSliderModel(0, 0.1, 0.5)),"w 100lp, wrap");
100 panel2.add(new JLabel("Packed diameter:"));
102 DoubleModel od = new DoubleModel(component,"Radius",2,UnitGroup.UNITS_LENGTH,0);
103 // Diameter = 2*Radius
105 spin = new JSpinner(od.getSpinnerModel());
106 spin.setEditor(new SpinnerEditor(spin));
107 panel2.add(spin,"growx");
109 panel2.add(new UnitSelector(od),"growx");
110 panel2.add(new BasicSlider(od.getSliderModel(0, 0.04, 0.2)),"w 100lp, wrap");
115 tabbedPane.insertTab("General", null, panel, "General properties", 0);
116 // tabbedPane.insertTab("Radial position", null, positionTab(),
117 // "Radial position configuration", 1);
118 tabbedPane.setSelectedIndex(0);