X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fplot%2FSimulationPlotPanel.java;fp=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fplot%2FSimulationPlotPanel.java;h=515ad0c8344e744a0a231846a40212f93aa2e1c4;hb=9349577cdfdff682b2aabd6daa24fdc3a7449b58;hp=06544f52676938211927e56925044e36a4995b9e;hpb=30ba0a882f0c061176ba14dbf86d3d6fad096c02;p=debian%2Fopenrocket diff --git a/core/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java b/core/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java index 06544f52..515ad0c8 100644 --- a/core/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java +++ b/core/src/net/sf/openrocket/gui/plot/SimulationPlotPanel.java @@ -119,8 +119,16 @@ public class SimulationPlotPanel extends JPanel { } configurationSelector.addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { + // We are only concerned with ItemEvent.SELECTED to update + // the UI when the selected item changes. + // TODO - this should probably be implemented as an ActionListener instead + // of ItemStateListener. + if ( e.getStateChange() == ItemEvent.DESELECTED) { + return; + } if (modifying > 0) return; PlotConfiguration conf = (PlotConfiguration) configurationSelector.getSelectedItem(); @@ -357,7 +365,9 @@ public class SimulationPlotPanel extends JPanel { typeSelectorPanel.add(new PlotTypeSelector(i, type, unit, axis), "wrap"); } - typeSelectorPanel.repaint(); + // In order to consistantly update the ui, we need to validate before repaint. + typeSelectorPanel.validate(); + typeSelectorPanel.repaint(); eventTableModel.fireTableDataChanged(); }