From db69efc42041e0647a90af79bb24c79104a66b9f Mon Sep 17 00:00:00 2001 From: kruland Date: Sun, 29 Dec 2013 20:05:44 -0600 Subject: [PATCH] Listen for table changes so the help text will be removed when the user adds a motor tube in the edit body tube dialog. --- .../flightconfigpanel/MotorConfigurationPanel.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/MotorConfigurationPanel.java b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/MotorConfigurationPanel.java index 836746166..88ae150d6 100644 --- a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/MotorConfigurationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/MotorConfigurationPanel.java @@ -23,6 +23,8 @@ import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; import javax.swing.table.TableCellRenderer; import net.miginfocom.swing.MigLayout; @@ -153,6 +155,16 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel } }; + // Listen to changes to the table so we can disable the help text when a + // motor mount is added through the edit body tube dialog. + configurationTableModel.addTableModelListener( new TableModelListener() { + + @Override + public void tableChanged(TableModelEvent e) { + MotorConfigurationPanel.this.updateButtonState(); + } + + }); JTable configurationTable = new JTable(configurationTableModel); configurationTable.getTableHeader().setReorderingAllowed(false); configurationTable.setCellSelectionEnabled(true); @@ -171,6 +183,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel } } }); + return configurationTable; }