diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 32a03ec9e..3ac8b3866 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -979,6 +979,12 @@ RocketCompCfg.tab.Outside = Outside RocketCompCfg.tab.Inside = Inside RocketCompCfg.tab.RightSide = Right Side RocketCompCfg.tab.LeftSide = Left Side +RocketCompCfg.btn.OK.ttip = Keep changes and close the dialog +RocketCompCfg.btn.Cancel.ttip = Discard changes and close the dialog +RocketCompCfg.CancelOperation.msg.discardChanges = Are you sure you want to discard your changes to this component? +RocketCompCfg.CancelOperation.msg.undoAdd = Are you sure you want to undo adding this component? +RocketCompCfg.CancelOperation.title = Cancel operation +RocketCompCfg.CancelOperation.checkbox.dontAskAgain = Don't ask me again ! BulkheadConfig BulkheadCfg.tab.Diameter = Diameter: diff --git a/swing/src/net/sf/openrocket/gui/configdialog/AxialStageConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/AxialStageConfig.java index 611e67920..56d89d8fc 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/AxialStageConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/AxialStageConfig.java @@ -16,7 +16,6 @@ import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel.Style; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.rocketcomponent.AxialStage; -import net.sf.openrocket.rocketcomponent.FlightConfiguration; import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration; import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration.SeparationEvent; @@ -38,7 +37,9 @@ public class AxialStageConfig extends ComponentAssemblyConfig { } // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java index 58835dec6..128bde727 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/BodyTubeConfig.java @@ -121,7 +121,9 @@ public class BodyTubeConfig extends RocketComponentConfig { trans.get("BodyTubecfg.tab.Motormountconf"), 1); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/BulkheadConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/BulkheadConfig.java index 1659a721c..d1bdb5e63 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/BulkheadConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/BulkheadConfig.java @@ -29,7 +29,9 @@ public class BulkheadConfig extends RingComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this panel - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/CenteringRingConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/CenteringRingConfig.java index 548bf4b86..5ac0bcc75 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/CenteringRingConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/CenteringRingConfig.java @@ -31,7 +31,9 @@ public class CenteringRingConfig extends RingComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this panel - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java b/swing/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java index e71f0f1c4..a3223c4e6 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java @@ -1,15 +1,11 @@ package net.sf.openrocket.gui.configdialog; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.Rectangle; import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; import java.util.List; import javax.swing.JDialog; @@ -48,6 +44,8 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis private OpenRocketDocument document = null; protected RocketComponent component = null; private RocketComponentConfig configurator = null; + private boolean isModified = false; + private final boolean isNewComponent; protected static boolean clearConfigListeners = true; private static String previousSelectedTab = null; // Name of the previous selected tab @@ -55,9 +53,10 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis private final Window parent; private static final Translator trans = Application.getTranslator(); - private ComponentConfigDialog(Window parent, OpenRocketDocument document, RocketComponent component) { + private ComponentConfigDialog(Window parent, OpenRocketDocument document, RocketComponent component, boolean isNewComponent) { super(parent); this.parent = parent; + this.isNewComponent = isNewComponent; setComponent(document, component); @@ -104,8 +103,10 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis this.document = document; this.component = component; this.document.getRocket().addComponentChangeListener(this); + this.isModified = false; configurator = getDialogContents(); + configurator.setNewComponent(isNewComponent); this.setContentPane(configurator); configurator.updateFields(); @@ -172,10 +173,8 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis @Override public void componentChanged(ComponentChangeEvent e) { if (e.isTreeChange() || e.isUndoChange()) { - // Hide dialog in case of tree or undo change disposeDialog(); - } else { /* * TODO: HIGH: The line below has caused a NullPointerException (without null check) @@ -183,8 +182,13 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis * root cause should be analyzed. * [Openrocket-bugs] 2009-12-12 19:23:22 Automatic bug report for OpenRocket 0.9.5 */ - if (configurator != null) + if (configurator != null) { configurator.updateFields(); + } + if (!this.isModified) { + setTitle("*" + getTitle()); + this.isModified = true; + } } } @@ -261,7 +265,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis previousSelectedTab = null; } - dialog = new ComponentConfigDialog(parent, document, component); + dialog = new ComponentConfigDialog(parent, document, component, isNewComponent); dialog.setVisible(true); if (parent instanceof BasicFrame && BasicFrame.getStartupFrame() == parent) { WindowLocationUtil.moveIfOutsideOfParentMonitor(dialog, parent); @@ -335,6 +339,13 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis return (dialog != null) && (dialog.isVisible()); } + /** + * Returns true if the current component has been modified or not. + */ + public boolean isModified() { + return isModified; + } + public int getSelectedTabIndex() { return configurator.getSelectedTabIndex(); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java index add84adfb..6d765b36f 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/EllipticalFinSetConfig.java @@ -201,7 +201,9 @@ public class EllipticalFinSetConfig extends FinSetConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java index 5bae5b08f..d83c8470d 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/FreeformFinSetConfig.java @@ -107,7 +107,9 @@ public class FreeformFinSetConfig extends FinSetConfig { addFinSetButtons(); // Apply the custom focus travel policy to this panel - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java index 45c984dd5..669b816e7 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/InnerTubeConfig.java @@ -207,7 +207,9 @@ public class InnerTubeConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java index 37d93a0fd..22f062436 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/LaunchLugConfig.java @@ -162,7 +162,9 @@ public class LaunchLugConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java index 5bb30f602..3934ee940 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/MassComponentConfig.java @@ -166,7 +166,9 @@ public class MassComponentConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java index 7829ebf69..828cc96a1 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/NoseConeConfig.java @@ -188,7 +188,9 @@ public class NoseConeConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java index 74f9f85e6..62259f074 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ParachuteConfig.java @@ -290,7 +290,9 @@ public class ParachuteConfig extends RecoveryDeviceConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java index da9c6af8c..1f9b25eef 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/RailButtonConfig.java @@ -35,7 +35,9 @@ public class RailButtonConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this panel - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java index c64590bda..5159dfc75 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/RocketComponentConfig.java @@ -9,6 +9,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -20,6 +22,7 @@ import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSpinner; @@ -51,18 +54,24 @@ import net.sf.openrocket.preset.ComponentPreset; import net.sf.openrocket.rocketcomponent.*; import net.sf.openrocket.rocketcomponent.position.AxialMethod; import net.sf.openrocket.startup.Application; +import net.sf.openrocket.startup.Preferences; import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.util.Invalidatable; public class RocketComponentConfig extends JPanel { private static final long serialVersionUID = -2925484062132243982L; + // Preference key + private static final String IGNORE_DISCARD_EDITING_WARNING = "IgnoreDiscardEditingWarning"; + private static final Translator trans = Application.getTranslator(); + private static final Preferences preferences = Application.getPreferences(); protected final OpenRocketDocument document; protected final RocketComponent component; protected final JTabbedPane tabbedPane; - protected final JDialog parent; + protected final ComponentConfigDialog parent; + protected boolean isNewComponent = false; // Checks whether this config dialog is editing an existing component, or a new one private final List invalidatables = new ArrayList(); protected final List order = new ArrayList<>(); // Component traversal order @@ -76,7 +85,8 @@ public class RocketComponentConfig extends JPanel { private final TextFieldListener textFieldListener; private JPanel buttonPanel; - protected JButton closeButton; + protected JButton okButton; + protected JButton cancelButton; private AppearancePanel appearancePanel = null; private JLabel infoLabel; @@ -90,7 +100,11 @@ public class RocketComponentConfig extends JPanel { this.document = document; this.component = component; - this.parent = parent; + if (parent instanceof ComponentConfigDialog) { + this.parent = (ComponentConfigDialog) parent; + } else { + this.parent = null; + } // Check the listeners for the same type and massive status allSameType = true; @@ -196,21 +210,73 @@ public class RocketComponentConfig extends JPanel { for (JButton b : buttons) { buttonPanel.add(b, "right, gap para"); } - - //// Close button - this.closeButton = new SelectColorButton(trans.get("dlg.but.close")); - closeButton.addActionListener(new ActionListener() { + + //// Cancel button + this.cancelButton = new SelectColorButton(trans.get("dlg.but.cancel")); + this.cancelButton.setToolTipText(trans.get("RocketCompCfg.btn.Cancel.ttip")); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + if (preferences.getBoolean(IGNORE_DISCARD_EDITING_WARNING, false)) { + ComponentConfigDialog.disposeDialog(); + document.undo(); + return; + } + if (!isNewComponent && parent != null && !parent.isModified()) { + ComponentConfigDialog.disposeDialog(); + return; + } + + // Yes/No dialog: Are you sure you want to discard your changes? + JPanel msg = createCancelOperationContent(); + int resultYesNo = JOptionPane.showConfirmDialog(RocketComponentConfig.this, msg, + trans.get("RocketCompCfg.CancelOperation.title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + ComponentConfigDialog.disposeDialog(); + if (resultYesNo == JOptionPane.YES_OPTION) { + document.undo(); + } + } + }); + buttonPanel.add(cancelButton, "split 2, right, gapleft 30lp"); + + //// Ok button + this.okButton = new SelectColorButton(trans.get("dlg.but.ok")); + this.okButton.setToolTipText(trans.get("RocketCompCfg.btn.OK.ttip")); + okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { ComponentConfigDialog.disposeDialog(); } }); - buttonPanel.add(closeButton, "right, gap 30lp"); - + buttonPanel.add(okButton); + updateFields(); this.add(buttonPanel, "newline, spanx, growx"); } + + private JPanel createCancelOperationContent() { + JPanel panel = new JPanel(new MigLayout()); + String msg = isNewComponent ? trans.get("RocketCompCfg.CancelOperation.msg.undoAdd") : + trans.get("RocketCompCfg.CancelOperation.msg.discardChanges"); + JLabel msgLabel = new JLabel(msg); + JCheckBox dontAskAgain = new JCheckBox(trans.get("RocketCompCfg.CancelOperation.checkbox.dontAskAgain")); + dontAskAgain.setSelected(false); + dontAskAgain.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + preferences.putBoolean(IGNORE_DISCARD_EDITING_WARNING, true); + } + // Unselected state should be impossible + } + }); + + panel.add(msgLabel, "left, wrap"); + panel.add(dontAskAgain, "left, gaptop para"); + + return panel; + } /** @@ -783,6 +849,14 @@ public class RocketComponentConfig extends JPanel { panel.add(sub); } + /** + * Sets whether this dialog is editing a new component (true), or an existing one (false). + * @param newComponent true if this dialog is editing a new component. + */ + public void setNewComponent(boolean newComponent) { + isNewComponent = newComponent; + } + /* * Private inner class to handle events in componentNameField. */ diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java index 40222576f..752d7995e 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ShockCordConfig.java @@ -142,7 +142,9 @@ public class ShockCordConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/SleeveConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/SleeveConfig.java index 4545660c9..d2261dfd6 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/SleeveConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/SleeveConfig.java @@ -31,7 +31,9 @@ public class SleeveConfig extends RingComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this panel - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java index e05cc0f6f..d3519c75d 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/StreamerConfig.java @@ -277,7 +277,9 @@ public class StreamerConfig extends RecoveryDeviceConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/ThicknessRingComponentConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/ThicknessRingComponentConfig.java index b204435a3..66ce8703e 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/ThicknessRingComponentConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/ThicknessRingComponentConfig.java @@ -33,7 +33,9 @@ public class ThicknessRingComponentConfig extends RingComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this panel - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java index b94fae163..f9050d396 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TransitionConfig.java @@ -24,7 +24,6 @@ import net.sf.openrocket.gui.components.UnitSelector; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.material.Material; import net.sf.openrocket.rocketcomponent.RocketComponent; -import net.sf.openrocket.rocketcomponent.SymmetricComponent; import net.sf.openrocket.rocketcomponent.Transition; import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; @@ -206,7 +205,9 @@ public class TransitionConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java index df54e7f2f..0744aa169 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TrapezoidFinSetConfig.java @@ -252,7 +252,9 @@ public class TrapezoidFinSetConfig extends FinSetConfig { addFinSetButtons(); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java index 9ce17a3a9..e0ea77134 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/TubeFinSetConfig.java @@ -179,7 +179,9 @@ public class TubeFinSetConfig extends RocketComponentConfig { tabbedPane.setSelectedIndex(0); // Apply the custom focus travel policy to this config dialog - order.add(closeButton); // Make sure the close button is the last component + //// Make sure the cancel & ok button is the last component + order.add(cancelButton); + order.add(okButton); CustomFocusTraversalPolicy policy = new CustomFocusTraversalPolicy(order); parent.setFocusTraversalPolicy(policy); }