Asynchronized UI loading.
This commit is contained in:
@@ -23,6 +23,7 @@ import java.awt.Cursor;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.GridLayout;
|
||||||
import java.awt.Transparency;
|
import java.awt.Transparency;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@@ -61,6 +62,7 @@ public final class MainFrame extends DraggableFrame {
|
|||||||
LauncherSettingsPanel launcherPanel;
|
LauncherSettingsPanel launcherPanel;
|
||||||
CardLayout infoLayout;
|
CardLayout infoLayout;
|
||||||
JPanel infoSwap;
|
JPanel infoSwap;
|
||||||
|
JPanel launcherPanelWrapper, gamePanelWrapper;
|
||||||
JLabel backgroundLabel, windowTitle;
|
JLabel backgroundLabel, windowTitle;
|
||||||
JPanel realPanel;
|
JPanel realPanel;
|
||||||
DropShadowBorder border;
|
DropShadowBorder border;
|
||||||
@@ -221,10 +223,12 @@ public final class MainFrame extends DraggableFrame {
|
|||||||
|
|
||||||
this.mainPanel = new MainPagePanel();
|
this.mainPanel = new MainPagePanel();
|
||||||
this.infoSwap.add(mainPanel, "main");
|
this.infoSwap.add(mainPanel, "main");
|
||||||
this.gamePanel = new GameSettingsPanel();
|
gamePanelWrapper = new JPanel();
|
||||||
this.infoSwap.add(gamePanel, "game");
|
gamePanelWrapper.setLayout(new GridLayout());
|
||||||
this.launcherPanel = new LauncherSettingsPanel();
|
this.infoSwap.add(gamePanelWrapper, "game");
|
||||||
this.infoSwap.add(launcherPanel, "launcher");
|
launcherPanelWrapper = new JPanel();
|
||||||
|
launcherPanelWrapper.setLayout(new GridLayout());
|
||||||
|
this.infoSwap.add(launcherPanelWrapper, "launcher");
|
||||||
|
|
||||||
truePanel.add(this.infoSwap, "Center");
|
truePanel.add(this.infoSwap, "Center");
|
||||||
centralPanel.setLayout(null);
|
centralPanel.setLayout(null);
|
||||||
@@ -246,10 +250,19 @@ public final class MainFrame extends DraggableFrame {
|
|||||||
this.mainTab.setIsActive(true);
|
this.mainTab.setIsActive(true);
|
||||||
this.mainPanel.onSelected();
|
this.mainPanel.onSelected();
|
||||||
} else if (tabName.equalsIgnoreCase("game")) {
|
} else if (tabName.equalsIgnoreCase("game")) {
|
||||||
|
if(gamePanel == null) {
|
||||||
|
gamePanel = new GameSettingsPanel();
|
||||||
|
gamePanelWrapper.add(gamePanel);
|
||||||
|
}
|
||||||
this.gameTab.setIsActive(true);
|
this.gameTab.setIsActive(true);
|
||||||
this.gamePanel.onSelected();
|
this.gamePanel.onSelected();
|
||||||
} else if (tabName.equalsIgnoreCase("launcher"))
|
} else if (tabName.equalsIgnoreCase("launcher")) {
|
||||||
|
if(launcherPanel == null) {
|
||||||
|
launcherPanel = new LauncherSettingsPanel();
|
||||||
|
launcherPanelWrapper.add(launcherPanel);
|
||||||
|
}
|
||||||
this.launcherTab.setIsActive(true);
|
this.launcherTab.setIsActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
this.infoLayout.show(this.infoSwap, tabName);
|
this.infoLayout.show(this.infoSwap, tabName);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user