Fix launch lug reference, no refactoring
This commit is contained in:
parent
fb4bba7722
commit
3e199d779f
@ -20,6 +20,9 @@ import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
|||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class LaunchLugConfig extends RocketComponentConfig {
|
public class LaunchLugConfig extends RocketComponentConfig {
|
||||||
|
|
||||||
@ -108,28 +111,33 @@ public class LaunchLugConfig extends RocketComponentConfig {
|
|||||||
|
|
||||||
// create a new panel for the right column
|
// create a new panel for the right column
|
||||||
panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
|
panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::][]", ""));
|
||||||
|
|
||||||
//// Position relative to:
|
//// Position relative to:
|
||||||
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")));
|
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.Posrelativeto")));
|
||||||
EnumModel<AxialMethod> positionModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
|
EnumModel<AxialMethod> positionModel = new EnumModel<AxialMethod>(component, "AxialMethod", AxialMethod.axialOffsetMethods );
|
||||||
JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( positionModel );
|
JComboBox<AxialMethod> positionCombo = new JComboBox<AxialMethod>( positionModel );
|
||||||
panel.add( positionCombo, "spanx, growx, wrap");
|
panel.add(positionCombo, "spanx, growx, wrap");
|
||||||
|
|
||||||
//// plus
|
//// plus
|
||||||
|
final DoubleModel mAxOff = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||||
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.plus")), "right");
|
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.plus")), "right");
|
||||||
|
spin = new JSpinner(mAxOff.getSpinnerModel()); // Plus quantity input
|
||||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
|
||||||
spin = new JSpinner(m.getSpinnerModel());
|
|
||||||
spin.setEditor(new SpinnerEditor(spin));
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
panel.add(spin, "growx");
|
panel.add(spin, "growx");
|
||||||
|
|
||||||
panel.add(new UnitSelector(m), "growx");
|
panel.add(new UnitSelector(mAxOff), "growx"); // Unity selection
|
||||||
panel.add(new BasicSlider(m.getSliderModel(
|
panel.add(new BasicSlider(mAxOff.getSliderModel( // Plus quantity slider
|
||||||
new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
|
new DoubleModel(component.getParent(), "Length", -1.0, UnitGroup.UNITS_NONE),
|
||||||
new DoubleModel(component.getParent(), "Length"))),
|
new DoubleModel(component.getParent(), "Length"))),
|
||||||
"w 100lp, wrap para");
|
"w 100lp, wrap para");
|
||||||
|
|
||||||
|
// Add an action listener to update the plus quantity, based on the selected reference point
|
||||||
|
positionCombo.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
mAxOff.stateChanged(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//// Material
|
//// Material
|
||||||
panel.add(materialPanel( Material.Type.BULK), "span, wrap");
|
panel.add(materialPanel( Material.Type.BULK), "span, wrap");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user