Move the component preset selection box outside of the first tab and under the component name. Adjusted the MigLayout parameters to the labels align.

This commit is contained in:
Kevin Ruland 2012-05-01 17:18:41 +00:00
parent fea3e6e61a
commit 2de2fb8a65

View File

@ -77,7 +77,7 @@ public class RocketComponentConfig extends JPanel {
public RocketComponentConfig(OpenRocketDocument document, RocketComponent component) { public RocketComponentConfig(OpenRocketDocument document, RocketComponent component) {
setLayout(new MigLayout("fill", "[grow, fill]")); setLayout(new MigLayout("fill", "[min,align right]:10[fill, grow]"));
this.document = document; this.document = document;
this.component = component; this.component = component;
@ -85,7 +85,7 @@ public class RocketComponentConfig extends JPanel {
JLabel label = new JLabel(trans.get("RocketCompCfg.lbl.Componentname")); JLabel label = new JLabel(trans.get("RocketCompCfg.lbl.Componentname"));
//// The component name. //// The component name.
label.setToolTipText(trans.get("RocketCompCfg.ttip.Thecomponentname")); label.setToolTipText(trans.get("RocketCompCfg.ttip.Thecomponentname"));
this.add(label, "split, gapright 10"); this.add(label);
componentNameField = new JTextField(15); componentNameField = new JTextField(15);
textFieldListener = new TextFieldListener(); textFieldListener = new TextFieldListener();
@ -93,11 +93,21 @@ public class RocketComponentConfig extends JPanel {
componentNameField.addFocusListener(textFieldListener); componentNameField.addFocusListener(textFieldListener);
//// The component name. //// The component name.
componentNameField.setToolTipText(trans.get("RocketCompCfg.ttip.Thecomponentname")); componentNameField.setToolTipText(trans.get("RocketCompCfg.ttip.Thecomponentname"));
this.add(componentNameField, "growx, growy 0, wrap"); this.add(componentNameField, "wrap");
if ( component.getPresetType() != null ) {
// If the component supports a preset, show the preset selection box.
this.add(new JLabel(trans.get("PresetModel.lbl.select")));
presetModel = new PresetModel( this, component);
((ComponentPresetDatabase)Application.getComponentPresetDao()).addDatabaseListener(presetModel);
presetComboBox = new JComboBox(presetModel);
presetComboBox.setEditable(false);
this.add(presetComboBox, "wrap");
}
tabbedPane = new JTabbedPane(); tabbedPane = new JTabbedPane();
this.add(tabbedPane, "growx, growy 1, wrap"); this.add(tabbedPane, "span, growx, growy 1, wrap");
//// Override and Mass and CG override options //// Override and Mass and CG override options
tabbedPane.addTab(trans.get("RocketCompCfg.tab.Override"), null, overrideTab(), tabbedPane.addTab(trans.get("RocketCompCfg.tab.Override"), null, overrideTab(),
@ -203,16 +213,6 @@ public class RocketComponentConfig extends JPanel {
protected JPanel materialPanel(JPanel panel, Material.Type type, protected JPanel materialPanel(JPanel panel, Material.Type type,
String materialString, String finishString) { String materialString, String finishString) {
if ( component.getPresetType() != null ) {
// If the component supports a preset, show the preset selection box.
panel.add(new JLabel(trans.get("PresetModel.lbl.select")));
presetModel = new PresetModel( this, component);
((ComponentPresetDatabase)Application.getComponentPresetDao()).addDatabaseListener(presetModel);
presetComboBox = new JComboBox(presetModel);
presetComboBox.setEditable(false);
panel.add(presetComboBox, "wrap para");
}
JLabel label = new JLabel(materialString); JLabel label = new JLabel(materialString);
//// The component material affects the weight of the component. //// The component material affects the weight of the component.
label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects")); label.setToolTipText(trans.get("RocketCompCfg.lbl.ttip.componentmaterialaffects"));