Skip to content

Commit

Permalink
replace container contents instead of adding to
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Jan 3, 2025
1 parent 79e1583 commit 27fb3b8
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,20 @@ private void deleteProfile(String uid) {
*/
private void changeProfile() {
String name = (String)configurationList.getSelectedItem();
if(name!=null) {
logger.debug("changing profile to {}",name);
if(plotterSettingsPanel!=null) {
this.remove(plotterSettingsPanel);
}
plotterSettingsManager.setLastSelectedProfile(name);
PlotterSettings plotterSettings = new PlotterSettings(name);
plotterSettingsPanel = new PlotterSettingsPanel(plotterSettings);
container.add(plotterSettingsPanel,BorderLayout.CENTER);
this.revalidate();
plotterSettingsPanel.addListener(this::firePlotterSettingsChanged);
firePlotterSettingsChanged(plotterSettings);
if(name==null) return;

logger.debug("changing profile to {}",name);
if(plotterSettingsPanel!=null) {
this.remove(plotterSettingsPanel);
}
plotterSettingsManager.setLastSelectedProfile(name);
PlotterSettings plotterSettings = new PlotterSettings(name);
plotterSettingsPanel = new PlotterSettingsPanel(plotterSettings);
container.removeAll();
container.add(plotterSettingsPanel,BorderLayout.CENTER);
this.revalidate();
plotterSettingsPanel.addListener(this::firePlotterSettingsChanged);
firePlotterSettingsChanged(plotterSettings);
}

/**
Expand Down

0 comments on commit 27fb3b8

Please sign in to comment.