New LaF
This commit is contained in:
@@ -41,7 +41,7 @@ if (buildnumber == null)
|
||||
|
||||
def versionroot = System.getenv("VERSION_ROOT")
|
||||
if (versionroot == null)
|
||||
versionroot = "2.7.3"
|
||||
versionroot = "2.7.4"
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = versionroot + '.' + buildnumber
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.net.Authenticator;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -34,14 +33,11 @@ import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.RepaintManager;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import org.jackhuang.hmcl.api.HMCLApi;
|
||||
import org.jackhuang.hmcl.api.HMCLog;
|
||||
import org.jackhuang.hmcl.api.ILogger;
|
||||
import org.jackhuang.hmcl.api.PluginManager;
|
||||
import org.jackhuang.hmcl.api.VersionNumber;
|
||||
import org.jackhuang.hmcl.laf.HelloMinecraftLookAndFeel;
|
||||
import org.jackhuang.hmcl.setting.Settings;
|
||||
import org.jackhuang.hmcl.ui.LogWindow;
|
||||
import org.jackhuang.hmcl.ui.MainFrame;
|
||||
@@ -57,6 +53,7 @@ import org.jackhuang.hmcl.util.log.layout.DefaultLayout;
|
||||
import org.jackhuang.hmcl.util.sys.ProcessManager;
|
||||
import org.jackhuang.hmcl.util.ui.MyRepaintManager;
|
||||
import org.jackhuang.hmcl.util.upgrade.IUpgrader;
|
||||
import org.jackhuang.hmcl.laf.BeautyEyeLNFHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -97,7 +94,7 @@ public final class Main implements Runnable {
|
||||
return "HMCL" + ' ' + LAUNCHER_VERSION;
|
||||
}
|
||||
|
||||
private static HelloMinecraftLookAndFeel LOOK_AND_FEEL;
|
||||
//private static HelloMinecraftLookAndFeel LOOK_AND_FEEL;
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
|
||||
|
||||
@@ -190,10 +187,9 @@ public final class Main implements Runnable {
|
||||
MessageBox.showLocalized("ui.message.open_jdk");
|
||||
|
||||
try {
|
||||
LOOK_AND_FEEL = new HelloMinecraftLookAndFeel(Settings.getInstance().getTheme().settings);
|
||||
UIManager.setLookAndFeel(LOOK_AND_FEEL);
|
||||
BeautyEyeLNFHelper.launchBeautyEyeLNF();
|
||||
RepaintManager.setCurrentManager(new MyRepaintManager());
|
||||
} catch (ParseException | UnsupportedLookAndFeelException ex) {
|
||||
} catch (Exception ex) {
|
||||
HMCLog.warn("Failed to set look and feel...", ex);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<Component class="javax.swing.JTable" name="lstDownloads">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="SwingUtils.makeDefaultTableModel(new String[]{C.i18n("install.version"), C.i18n("install.time"), C.i18n("install.type")},new Class[]{String.class, String.class, String.class}, new boolean[]{false, false, false})" type="code"/>
|
||||
<Connection code="SwingUtils.makeDefaultTableModel(new String[]{C.i18n("install.version"), C.i18n("install.release_time"), C.i18n("install.time"), C.i18n("install.type")},new Class[]{String.class, String.class, String.class, String.class}, new boolean[]{false, false, false, false})" type="code"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
<Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor">
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui;
|
||||
|
||||
import org.jackhuang.hmcl.util.ui.Page;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.jackhuang.hmcl.api.ui.TopTabPage;
|
||||
import org.jackhuang.hmcl.core.download.MinecraftRemoteVersions;
|
||||
import org.jackhuang.hmcl.setting.Settings;
|
||||
import org.jackhuang.hmcl.util.C;
|
||||
@@ -64,7 +65,7 @@ public class GameDownloadPanel extends Page {
|
||||
}
|
||||
});
|
||||
|
||||
lstDownloads.setModel(SwingUtils.makeDefaultTableModel(new String[]{C.i18n("install.version"), C.i18n("install.time"), C.i18n("install.type")},new Class[]{String.class, String.class, String.class}, new boolean[]{false, false, false}));
|
||||
lstDownloads.setModel(SwingUtils.makeDefaultTableModel(new String[]{C.i18n("install.version"), C.i18n("install.release_time"), C.i18n("install.time"), C.i18n("install.type")},new Class[]{String.class, String.class, String.class, String.class}, new boolean[]{false, false, false, false}));
|
||||
lstDownloads.setToolTipText("");
|
||||
lstDownloads.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
jScrollPane2.setViewportView(lstDownloads);
|
||||
@@ -110,7 +111,7 @@ public class GameDownloadPanel extends Page {
|
||||
DefaultTableModel model = SwingUtils.clearDefaultTable(lstDownloads);
|
||||
model.addRow(new Object[] { C.i18n("message.loading"), "", "" });
|
||||
MinecraftRemoteVersions.refreshRomoteVersions(Settings.getLastProfile().service().getDownloadType())
|
||||
.reg((ver) -> model.addRow(new Object[] { ver.id, ver.time,
|
||||
.reg((ver) -> model.addRow(new Object[] { ver.id, ver.releaseTime, ver.time,
|
||||
StrUtils.equalsOne(ver.type, "old_beta", "old_alpha", "release", "snapshot") ? C.i18n("versions." + ver.type) : ver.type }))
|
||||
.regDone(SwingUtils.invokeLater(() -> {
|
||||
lstDownloads.requestFocus();
|
||||
@@ -138,8 +139,8 @@ public class GameDownloadPanel extends Page {
|
||||
boolean refreshedDownloads = false;
|
||||
|
||||
@Override
|
||||
public void onSelect() {
|
||||
super.onSelect();
|
||||
public void onSelect(TopTabPage page) {
|
||||
super.onSelect(page);
|
||||
if (!refreshedDownloads) {
|
||||
refreshedDownloads = true;
|
||||
refreshDownloads();
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="tabVersionEdit" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="tabVersionEdit" alignment="1" pref="766" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="btnMakeLaunchScript" min="-2" max="-2" attributes="0"/>
|
||||
@@ -42,7 +42,7 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="577" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="677" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -50,7 +50,7 @@
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="pnlTop" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="pnlTop" min="-2" pref="70" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="tabVersionEdit" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@@ -63,7 +63,7 @@
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="400" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="403" max="32767" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -119,7 +119,7 @@
|
||||
<Component id="lblDimensionX" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtHeight" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="88" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="182" max="32767" attributes="0"/>
|
||||
<Component id="chkFullscreen" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
@@ -194,7 +194,7 @@
|
||||
<Component id="lblDimension" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtWidth" alignment="3" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="39" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="51" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnDownloadAllAssets" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnCleanGame" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@@ -408,7 +408,7 @@
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtJavaArgs" pref="325" max="32767" attributes="0"/>
|
||||
<Component id="txtJavaArgs" pref="457" max="32767" attributes="0"/>
|
||||
<Component id="txtMinecraftArgs" max="32767" attributes="0"/>
|
||||
<Component id="txtPermSize" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@@ -421,7 +421,7 @@
|
||||
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkNoCommon" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="96" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="190" max="32767" attributes="0"/>
|
||||
<Component id="chkDontCheckGame" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
@@ -627,7 +627,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jScrollPane1" pref="550" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="644" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="btnRemoveMod" max="32767" attributes="0"/>
|
||||
@@ -635,7 +635,7 @@
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="lblModInfo" pref="646" max="32767" attributes="0"/>
|
||||
<Component id="lblModInfo" pref="751" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -650,7 +650,7 @@
|
||||
<Component id="btnRemoveMod" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane1" pref="259" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="271" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblModInfo" min="-2" max="-2" attributes="0"/>
|
||||
@@ -723,6 +723,9 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="pnlAutoInstall">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new Page()"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="<settings.tabs.installers>">
|
||||
|
||||
@@ -322,7 +322,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
btnAddMod = new javax.swing.JButton();
|
||||
btnRemoveMod = new javax.swing.JButton();
|
||||
lblModInfo = new javax.swing.JLabel();
|
||||
pnlAutoInstall = new javax.swing.JPanel();
|
||||
pnlAutoInstall = new Page();
|
||||
tabInstallers = new NewTabPane();
|
||||
pnlTop = new javax.swing.JPanel();
|
||||
pnlSelection = new javax.swing.JPanel();
|
||||
@@ -479,7 +479,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addComponent(lblDimensionX)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 88, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 182, Short.MAX_VALUE)
|
||||
.addComponent(chkFullscreen))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlSettingsLayout.createSequentialGroup()
|
||||
.addComponent(txtMaxMemory)
|
||||
@@ -539,7 +539,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addComponent(lblDimensionX, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDimension)
|
||||
.addComponent(txtWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
|
||||
.addGroup(pnlSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnDownloadAllAssets)
|
||||
.addComponent(btnCleanGame))
|
||||
@@ -632,7 +632,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addComponent(lblJavaArgs))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtJavaArgs, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
|
||||
.addComponent(txtJavaArgs, javax.swing.GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE)
|
||||
.addComponent(txtMinecraftArgs)
|
||||
.addComponent(txtPermSize, javax.swing.GroupLayout.Alignment.TRAILING)))
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
@@ -643,7 +643,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkNoCommon)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 190, Short.MAX_VALUE)
|
||||
.addComponent(chkDontCheckGame))
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -728,13 +728,13 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
pnlModManagementContentLayout.setHorizontalGroup(
|
||||
pnlModManagementContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlModManagementContentLayout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 644, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlModManagementContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(btnRemoveMod, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnAddMod, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlModManagementContentLayout.createSequentialGroup()
|
||||
.addComponent(lblModInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 646, Short.MAX_VALUE)
|
||||
.addComponent(lblModInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 751, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
pnlModManagementContentLayout.setVerticalGroup(
|
||||
@@ -746,7 +746,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnRemoveMod)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblModInfo))
|
||||
);
|
||||
@@ -950,7 +950,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tabVersionEdit, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(tabVersionEdit, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 766, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnMakeLaunchScript)
|
||||
@@ -963,12 +963,12 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addContainerGap(577, Short.MAX_VALUE)))
|
||||
.addContainerGap(677, Short.MAX_VALUE)))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pnlTop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(pnlTop, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(tabVersionEdit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
@@ -979,7 +979,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(400, Short.MAX_VALUE)
|
||||
.addContainerGap(403, Short.MAX_VALUE)
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addContainerGap()))
|
||||
);
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jackhuang.hmcl.util.ui.Page;
|
||||
import java.util.List;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.jackhuang.hmcl.api.ui.TopTabPage;
|
||||
import org.jackhuang.hmcl.util.C;
|
||||
import org.jackhuang.hmcl.setting.Settings;
|
||||
import org.jackhuang.hmcl.core.install.InstallerType;
|
||||
@@ -164,7 +165,8 @@ public class InstallerPanel extends Page {
|
||||
boolean refreshed = false;
|
||||
|
||||
@Override
|
||||
public void onSelect() {
|
||||
public void onSelect(TopTabPage page) {
|
||||
super.onSelect(page);
|
||||
if (!refreshed) {
|
||||
TaskWindow.factory().execute(refreshVersionsTask());
|
||||
refreshed = true;
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.jackhuang.hmcl.util.C;
|
||||
import org.jackhuang.hmcl.util.MessageBox;
|
||||
import org.jackhuang.hmcl.api.func.Consumer;
|
||||
import org.jackhuang.hmcl.api.HMCLog;
|
||||
import org.jackhuang.hmcl.util.DefaultPlugin;
|
||||
import org.jackhuang.hmcl.util.sys.FileUtils;
|
||||
import org.jackhuang.hmcl.util.sys.ProcessMonitor;
|
||||
import org.jackhuang.hmcl.util.net.WebFrame;
|
||||
@@ -111,6 +112,7 @@ public class LaunchingUIDaemon {
|
||||
void runGame(Profile profile) {
|
||||
MainFrame.INSTANCE.showMessage(C.i18n("ui.message.launching"));
|
||||
profile.launcher().genLaunchCode(value -> {
|
||||
DefaultPlugin.INSTANCE.saveAuthenticatorConfig();
|
||||
((HMCLGameLauncher.GameLauncherTag) value.getTag()).state = 1;
|
||||
}, MainFrame.INSTANCE::failed, Settings.getInstance().getAuthenticator().getPassword());
|
||||
}
|
||||
@@ -118,6 +120,7 @@ public class LaunchingUIDaemon {
|
||||
void makeLaunchScript(Profile profile) {
|
||||
MainFrame.INSTANCE.showMessage(C.i18n("ui.message.launching"));
|
||||
profile.launcher().genLaunchCode(value -> {
|
||||
DefaultPlugin.INSTANCE.saveAuthenticatorConfig();
|
||||
((HMCLGameLauncher.GameLauncherTag) value.getTag()).state = 2;
|
||||
}, MainFrame.INSTANCE::failed, Settings.getInstance().getAuthenticator().getPassword());
|
||||
}
|
||||
@@ -154,9 +157,8 @@ public class LaunchingUIDaemon {
|
||||
if (v != LauncherVisibility.KEEP && !LogWindow.INSTANCE.isVisible()) {
|
||||
HMCLog.log("Launcher will exit now.");
|
||||
System.exit(0);
|
||||
} else {
|
||||
} else
|
||||
HMCLog.log("Launcher will not exit now.");
|
||||
}
|
||||
}
|
||||
|
||||
private static final Consumer<LaunchSucceededEvent> LAUNCH_SCRIPT_FINISHER = event -> {
|
||||
|
||||
@@ -40,6 +40,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
@@ -49,6 +50,7 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import org.jackhuang.hmcl.api.HMCLApi;
|
||||
import org.jackhuang.hmcl.Main;
|
||||
import org.jackhuang.hmcl.api.PluginManager;
|
||||
@@ -165,7 +167,6 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
|
||||
private void initComponents() {
|
||||
setLayout(null);
|
||||
initBorderColor(Settings.getInstance().getTheme());
|
||||
|
||||
realPanel = new JPanel();
|
||||
realPanel.setLayout(null);
|
||||
@@ -255,6 +256,8 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
|
||||
realPanel.setBounds(1, 0, 800, 511);
|
||||
add(realPanel);
|
||||
|
||||
reloadColor(Settings.getInstance().getTheme());
|
||||
}
|
||||
|
||||
private transient final ActionListener tabListener = e -> MainFrame.this.selectTab(e.getActionCommand());
|
||||
@@ -277,11 +280,12 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
|
||||
public void selectTab(String tabName) {
|
||||
int chosen = -1;
|
||||
TopTabPage onCreate = null, onSelect = null;
|
||||
TopTabPage onCreate = null, onSelect = null, lastPage = null;
|
||||
for (int i = 0; i < tabHeader.size(); i++)
|
||||
if (tabName.equalsIgnoreCase(tabHeader.get(i).getActionCommand())) {
|
||||
if (!tabContent.get(i).isCreated()) {
|
||||
onCreate = tabContent.get(i);
|
||||
onCreate.setId(i);
|
||||
tabWrapper[i].add(tabContent.get(i));
|
||||
} else if (tabContent.get(i).isSelected())
|
||||
continue;
|
||||
@@ -290,8 +294,10 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
}
|
||||
if (chosen != -1) {
|
||||
for (int i = 0; i < tabHeader.size(); i++)
|
||||
if (i != chosen && tabContent.get(i) != null && tabContent.get(i).isSelected())
|
||||
tabContent.get(i).onLeave();
|
||||
if (i != chosen && tabContent.get(i) != null && tabContent.get(i).isSelected()) {
|
||||
lastPage = tabContent.get(i);
|
||||
lastPage.onLeave();
|
||||
}
|
||||
for (int i = 0; i < tabHeader.size(); i++)
|
||||
if (i == chosen) {
|
||||
for (int j = 0; j < tabHeader.size(); j++)
|
||||
@@ -305,7 +311,7 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
if (onCreate != null)
|
||||
onCreate.onCreate();
|
||||
if (onSelect != null)
|
||||
onSelect.onSelect();
|
||||
onSelect.onSelect(lastPage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,13 +388,18 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
Color borderColor;
|
||||
Color borderColorDarker;
|
||||
|
||||
private void initBorderColor(Theme t) {
|
||||
borderColor = GraphicsUtils.getWebColor(t.settings.get("Customized.MainFrame.background"));
|
||||
borderColorDarker = GraphicsUtils.getWebColor(t.settings.get("Customized.MainFrame.selected_background"));
|
||||
private void initBorderColor() {
|
||||
borderColor = UIManager.getColor("Customized.MainFrame.background");
|
||||
borderColorDarker = UIManager.getColor("Customized.MainFrame.selected_background");
|
||||
}
|
||||
|
||||
public void reloadColor(Theme t) {
|
||||
initBorderColor(t);
|
||||
for (Map.Entry<String, String> entry : t.settings.entrySet()) {
|
||||
if (entry.getValue().startsWith("#"))
|
||||
UIManager.put(entry.getKey(), GraphicsUtils.getWebColor(entry.getValue()));
|
||||
}
|
||||
|
||||
initBorderColor();
|
||||
if (border != null)
|
||||
border.setColor(borderColor);
|
||||
header.setBackground(borderColor);
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.jackhuang.hmcl.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hmcl.setting.Settings;
|
||||
import org.jackhuang.hmcl.core.mod.ModpackManager;
|
||||
import org.jackhuang.hmcl.ui.modpack.ModpackWizard;
|
||||
import org.jackhuang.hmcl.laf.ConstomButton;
|
||||
import org.jackhuang.hmcl.laf.button.CustomButton;
|
||||
import org.jackhuang.hmcl.api.func.Consumer;
|
||||
import org.jackhuang.hmcl.util.sys.FileUtils;
|
||||
import org.jackhuang.hmcl.util.task.TaskWindow;
|
||||
@@ -54,6 +54,7 @@ import org.jackhuang.hmcl.util.ui.JSystemFileChooser;
|
||||
import org.jackhuang.hmcl.util.ui.SwingUtils;
|
||||
import org.jackhuang.hmcl.util.ui.wizard.api.WizardDisplayer;
|
||||
import org.jackhuang.hmcl.api.auth.IAuthenticator;
|
||||
import org.jackhuang.hmcl.laf.button.CustomButtonUI;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -67,13 +68,11 @@ public class MainPagePanel extends Page {
|
||||
void initGui() {
|
||||
initComponents();
|
||||
|
||||
animationEnabled = false;
|
||||
|
||||
pnlButtons = new javax.swing.JPanel();
|
||||
pnlButtons.setLayout(null);
|
||||
|
||||
int w = 150, h = 50;
|
||||
btnRun = new ConstomButton();
|
||||
btnRun = new CustomButton();
|
||||
btnRun.setBounds(0, 0, w, h);
|
||||
Font font = btnRun.getFont();
|
||||
Font newFont = new Font(font.getName(), font.getStyle(), 15);
|
||||
@@ -82,6 +81,7 @@ public class MainPagePanel extends Page {
|
||||
btnRun.setText(C.i18n("ui.button.run"));
|
||||
btnRun.setFont(newFont);
|
||||
btnRun.addActionListener(e -> MainFrame.INSTANCE.daemon.runGame(Settings.getLastProfile()));
|
||||
btnRun.setUI(new CustomButtonUI());
|
||||
|
||||
pnlRoot.add(pnlButtons);
|
||||
pnlButtons.setBounds(0, 0, w, h);
|
||||
@@ -434,7 +434,7 @@ public class MainPagePanel extends Page {
|
||||
boolean preparingAuth = true;
|
||||
private boolean isLoading = false;
|
||||
private javax.swing.JPanel pnlButtons;
|
||||
private ConstomButton btnRun;
|
||||
private CustomButton btnRun;
|
||||
private static final int DEFAULT_WIDTH = 800, DEFAULT_HEIGHT = 480;
|
||||
//</editor-fold>
|
||||
|
||||
|
||||
@@ -40,10 +40,20 @@ public class NewTabPane extends JTabbedPane implements ChangeListener {
|
||||
if (initializing)
|
||||
return;
|
||||
for (int i = 0; i < getComponentCount(); ++i)
|
||||
if (getSelectedIndex() != i && getComponent(i) instanceof TopTabPage)
|
||||
((TopTabPage) getComponent(i)).onLeave();
|
||||
if (getSelectedComponent() instanceof TopTabPage)
|
||||
((TopTabPage) getSelectedComponent()).onSelect();
|
||||
if (getComponent(i) instanceof TopTabPage) {
|
||||
TopTabPage comp = (TopTabPage) getComponent(i);
|
||||
comp.setId(i);
|
||||
if (getSelectedIndex() != i)
|
||||
((TopTabPage) getComponent(i)).onLeave();
|
||||
}
|
||||
if (getSelectedComponent() instanceof TopTabPage) {
|
||||
if (page == null && getComponentCount() > 0 && getComponent(0) instanceof TopTabPage)
|
||||
page = (TopTabPage) getComponent(0);
|
||||
((TopTabPage) getSelectedComponent()).onSelect(page);
|
||||
page = (TopTabPage) getSelectedComponent();
|
||||
}
|
||||
}
|
||||
|
||||
TopTabPage page = null;
|
||||
|
||||
}
|
||||
|
||||
@@ -37,8 +37,10 @@ import org.jackhuang.hmcl.laf.LAFTheme;
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class DefaultPlugin implements IPlugin {
|
||||
public static DefaultPlugin INSTANCE;
|
||||
|
||||
public DefaultPlugin() {
|
||||
INSTANCE = this;
|
||||
for (Theme t : LAFTheme.THEMES)
|
||||
Theme.THEMES.put(t.getId(), t);
|
||||
}
|
||||
@@ -52,11 +54,8 @@ public class DefaultPlugin implements IPlugin {
|
||||
auths.add(new YggdrasilAuthenticator(clientToken));
|
||||
|
||||
try {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
for (IAuthenticator i : auths)
|
||||
Settings.getInstance().setAuthenticatorConfig(i.id(), i.onSaveSettings());
|
||||
}));
|
||||
} catch(IllegalStateException ignore) { // Shutdown in progress
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(this::saveAuthenticatorConfig));
|
||||
} catch (IllegalStateException ignore) { // Shutdown in progress
|
||||
}
|
||||
for (IAuthenticator i : auths) {
|
||||
i.onLoadSettings(Settings.getInstance().getAuthenticatorConfig(i.id()));
|
||||
@@ -64,6 +63,11 @@ public class DefaultPlugin implements IPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveAuthenticatorConfig() {
|
||||
for (IAuthenticator i : auths)
|
||||
Settings.getInstance().setAuthenticatorConfig(i.id(), i.onSaveSettings());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddTab(JFrame frame, AddTabCallback callback) {
|
||||
callback.addTab(new MainPagePanel(), "main", C.i18n("launcher.title.main"));
|
||||
|
||||
Reference in New Issue
Block a user