@@ -103,15 +103,15 @@ public final class Controllers {
103103 });
104104 private static Lazy <RootPage > rootPage = new Lazy <>(RootPage ::new );
105105 private static DecoratorController decorator ;
106- private static Lazy < DownloadPage > downloadPage = new Lazy <>( DownloadPage :: new ) ;
106+ private static DownloadPage downloadPage ;
107107 private static Lazy <AccountListPage > accountListPage = new Lazy <>(() -> {
108108 AccountListPage accountListPage = new AccountListPage ();
109109 accountListPage .selectedAccountProperty ().bindBidirectional (Accounts .selectedAccountProperty ());
110110 accountListPage .accountsProperty ().bindContent (Accounts .getAccounts ());
111111 accountListPage .authServersProperty ().bindContentBidirectional (config ().getAuthlibInjectorServers ());
112112 return accountListPage ;
113113 });
114- private static Lazy < LauncherSettingsPage > settingsPage = new Lazy <>( LauncherSettingsPage :: new ) ;
114+ private static LauncherSettingsPage settingsPage ;
115115 private static Lazy <TerracottaPage > terracottaPage = new Lazy <>(TerracottaPage ::new );
116116
117117 private Controllers () {
@@ -142,7 +142,18 @@ public static RootPage getRootPage() {
142142
143143 // FXThread
144144 public static LauncherSettingsPage getSettingsPage () {
145- return settingsPage .get ();
145+ if (settingsPage == null ) {
146+ settingsPage = new LauncherSettingsPage ();
147+ }
148+ return settingsPage ;
149+ }
150+
151+ @ FXThread
152+ public static void prepareSettingsPage () {
153+ if (settingsPage == null ) {
154+ LOG .info ("Prepare the settings page" );
155+ settingsPage = FXUtils .prepareNode (new LauncherSettingsPage ());
156+ }
146157 }
147158
148159 // FXThread
@@ -152,7 +163,18 @@ public static AccountListPage getAccountListPage() {
152163
153164 // FXThread
154165 public static DownloadPage getDownloadPage () {
155- return downloadPage .get ();
166+ if (downloadPage == null ) {
167+ downloadPage = new DownloadPage ();
168+ }
169+ return downloadPage ;
170+ }
171+
172+ @ FXThread
173+ public static void prepareDownloadPage () {
174+ if (downloadPage == null ) {
175+ LOG .info ("Prepare the download page" );
176+ downloadPage = FXUtils .prepareNode (new DownloadPage ());
177+ }
156178 }
157179
158180 // FXThread
@@ -533,6 +555,7 @@ public static void shutdown() {
533555 downloadPage = null ;
534556 accountListPage = null ;
535557 settingsPage = null ;
558+ terracottaPage = null ;
536559 decorator = null ;
537560 stage = null ;
538561 scene = null ;
0 commit comments