Movedfunction down in order of calling.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 31.10.2023
|
||||
* @lastChange 30.12.2023
|
||||
*/
|
||||
package gui.src.frames;
|
||||
|
||||
@@ -8,16 +9,19 @@ import javax.swing.*;
|
||||
|
||||
import data.src.ControllerToView.ControllerToViewData;
|
||||
import data.src.ControllerToView.ControllerToViewData.ControllerEvent;
|
||||
|
||||
import gui.src.constants.GUIConstants;
|
||||
import gui.src.constants.GUIConstants.Panel;
|
||||
import gui.src.constants.GUIConstants.Theme;
|
||||
|
||||
import gui.src.interfaces.Themeable;
|
||||
|
||||
import gui.src.menubar.MenuBar;
|
||||
import gui.src.panels.ControllingPanel;
|
||||
import gui.src.panels.ConnectToServerPanel.ConnectToServerPanel;
|
||||
import gui.src.panels.ConnectionsTablePanel.ConnectionsTablePanel;
|
||||
import gui.src.panels.ControllingPanel.ControllingPanel;
|
||||
import gui.src.panels.MonitoringPanel.MonitoringPanel;
|
||||
import gui.src.panels.StatusPanel;
|
||||
import gui.src.panels.StatusPanel.StatusPanel;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -43,6 +47,31 @@ public final class MainFrame extends JFrame implements Themeable {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setPanel(Panel kindOfPanel) {
|
||||
try {
|
||||
switch (kindOfPanel) {
|
||||
case MonitoringPanel: {
|
||||
this.setPanel(MonitoringPanel.getInstance());
|
||||
}break;
|
||||
case ControllingPanel: {
|
||||
this.setPanel(ControllingPanel.getInstance());
|
||||
}break;
|
||||
case ConnectToServerPanel: {
|
||||
this.setPanel(ConnectToServerPanel.getInstance());
|
||||
}break;
|
||||
case ConnectionsTablePanel: {
|
||||
this.setPanel(ConnectionsTablePanel.getInstance());
|
||||
}break;
|
||||
default: {
|
||||
throw new Exception("Unknown kind of panel.");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
this.setPanel(Panel.MonitoringPanel);
|
||||
}
|
||||
}
|
||||
|
||||
private void setPanel(JPanel panel) {
|
||||
this.getContentPane().removeAll();
|
||||
|
||||
@@ -72,32 +101,7 @@ public final class MainFrame extends JFrame implements Themeable {
|
||||
this.update(this.getGraphics());
|
||||
}
|
||||
|
||||
|
||||
public void setPanel(Panel kindOfPanel) {
|
||||
try {
|
||||
switch (kindOfPanel) {
|
||||
case MonitoringPanel: {
|
||||
this.setPanel(MonitoringPanel.getInstance());
|
||||
}break;
|
||||
case ControllingPanel: {
|
||||
this.setPanel(ControllingPanel.getInstance());
|
||||
}break;
|
||||
case ConnectToServerPanel: {
|
||||
this.setPanel(ConnectToServerPanel.getInstance());
|
||||
}break;
|
||||
case ConnectionsTablePanel: {
|
||||
this.setPanel(ConnectionsTablePanel.getInstance());
|
||||
}break;
|
||||
default: {
|
||||
throw new Exception("Unknown kind of panel.");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
this.setPanel(Panel.MonitoringPanel);
|
||||
}
|
||||
}
|
||||
|
||||
// Nice to have
|
||||
public void setThemeColor(Theme themeColor) {
|
||||
try {
|
||||
switch (themeColor) {
|
||||
|
||||
Reference in New Issue
Block a user