mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-03-01 17:25:53 +08:00
Redesign the UI.
This commit is contained in:
parent
981a11d98b
commit
f9968580af
@ -25,7 +25,7 @@ if (!hasProperty('mainClass')) {
|
||||
ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main'
|
||||
}
|
||||
|
||||
def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".1" : "."+System.getenv("BUILD_NUMBER")
|
||||
def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".2" : "."+System.getenv("BUILD_NUMBER")
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = '2.3.5' + buildnumber
|
||||
|
@ -100,7 +100,7 @@ public final class Main implements Runnable {
|
||||
}
|
||||
|
||||
public static String launcherName = "Hello Minecraft! Launcher";
|
||||
public static byte firstVer = 2, secondVer = 3, thirdVer = 5, forthVer = 1;
|
||||
public static byte firstVer = 2, secondVer = 3, thirdVer = 5, forthVer = 2;
|
||||
public static int minimumLauncherVersion = 16;
|
||||
|
||||
/**
|
||||
|
@ -89,7 +89,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
||||
if (enableLogger) HMCLog.err(text);
|
||||
else System.out.println(text);
|
||||
|
||||
if (!checkThrowable(e)) {
|
||||
if (checkThrowable(e)) {
|
||||
SwingUtilities.invokeLater(() -> LogWindow.instance.showAsCrashWindow(UpdateChecker.OUT_DATED));
|
||||
if (!UpdateChecker.OUT_DATED)
|
||||
reportToServer(text, s);
|
||||
|
@ -22,12 +22,22 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="btnCleanGame" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnShowLog" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnMakeLaunchScript" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="tabVersionEdit" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="tabVersionEdit" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
@ -37,7 +47,12 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="tabVersionEdit" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnIncludeMinecraft" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnMakeLaunchScript" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnShowLog" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnCleanGame" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -91,7 +106,7 @@
|
||||
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtHeight" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="320" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="306" max="32767" attributes="0"/>
|
||||
<Component id="chkFullscreen" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
@ -535,7 +550,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="606" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="592" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="btnRemoveMod" min="-2" max="-2" attributes="0"/>
|
||||
@ -672,7 +687,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jScrollPane11" pref="601" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane11" pref="587" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="btnDownloadForge" alignment="0" max="32767" attributes="0"/>
|
||||
@ -752,7 +767,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane13" pref="601" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane13" pref="587" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="btnDownloadOptifine" max="32767" attributes="0"/>
|
||||
@ -832,7 +847,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane12" pref="601" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane12" pref="587" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="btnInstallLiteLoader" alignment="0" max="32767" attributes="0"/>
|
||||
@ -918,7 +933,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane2" pref="606" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane2" pref="592" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="btnRefreshGameDownloads" alignment="0" max="32767" attributes="0"/>
|
||||
@ -1211,5 +1226,33 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnIncludeMinecraftActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnMakeLaunchScript">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="mainwindow.make_launch_script" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMakeLaunchScriptActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnShowLog">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="mainwindow.show_log" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnShowLogActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnCleanGame">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="清理游戏文件"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCleanGameActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -80,6 +80,7 @@ import org.jackhuang.hellominecraft.utils.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.utils.system.Java;
|
||||
import org.jackhuang.hellominecraft.version.MinecraftRemoteVersion;
|
||||
import org.jackhuang.hellominecraft.version.MinecraftRemoteVersions;
|
||||
import org.jackhuang.hellominecraft.views.LogWindow;
|
||||
import org.jackhuang.hellominecraft.views.Selector;
|
||||
|
||||
/**
|
||||
@ -338,6 +339,9 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
|
||||
btnRemoveProfile = new javax.swing.JButton();
|
||||
btnExplore = new javax.swing.JButton();
|
||||
btnIncludeMinecraft = new javax.swing.JButton();
|
||||
btnMakeLaunchScript = new javax.swing.JButton();
|
||||
btnShowLog = new javax.swing.JButton();
|
||||
btnCleanGame = new javax.swing.JButton();
|
||||
|
||||
setBackground(new java.awt.Color(255, 255, 255));
|
||||
|
||||
@ -468,7 +472,7 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
|
||||
.addComponent(jLabel9)
|
||||
.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, 320, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 306, Short.MAX_VALUE)
|
||||
.addComponent(chkFullscreen))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel22Layout.createSequentialGroup()
|
||||
.addComponent(txtMaxMemory)
|
||||
@ -692,7 +696,7 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
|
||||
jPanel7Layout.setHorizontalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(btnRemoveMod)
|
||||
@ -756,7 +760,7 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
|
||||
jPanel16Layout.setHorizontalGroup(
|
||||
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup()
|
||||
.addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 587, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(btnDownloadForge, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@ -799,7 +803,7 @@ btnRefreshOptifine.addActionListener(new java.awt.event.ActionListener() {
|
||||
pnlOptifineLayout.setHorizontalGroup(
|
||||
pnlOptifineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlOptifineLayout.createSequentialGroup()
|
||||
.addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 587, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlOptifineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(btnDownloadOptifine, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@ -842,7 +846,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
jPanel3Layout.setHorizontalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 587, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(btnInstallLiteLoader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@ -898,7 +902,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
pnlGameDownloadsLayout.setHorizontalGroup(
|
||||
pnlGameDownloadsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlGameDownloadsLayout.createSequentialGroup()
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlGameDownloadsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(btnRefreshGameDownloads, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@ -1062,16 +1066,45 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
}
|
||||
});
|
||||
|
||||
btnMakeLaunchScript.setText(bundle.getString("mainwindow.make_launch_script")); // NOI18N
|
||||
btnMakeLaunchScript.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnMakeLaunchScriptActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnShowLog.setText(bundle.getString("mainwindow.show_log")); // NOI18N
|
||||
btnShowLog.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnShowLogActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnCleanGame.setText("清理游戏文件");
|
||||
btnCleanGame.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnCleanGameActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(tabVersionEdit)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnCleanGame)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnShowLog)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnMakeLaunchScript))
|
||||
.addComponent(tabVersionEdit))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -1080,7 +1113,11 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(tabVersionEdit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addComponent(btnMakeLaunchScript)
|
||||
.addComponent(btnShowLog)
|
||||
.addComponent(btnCleanGame))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
@ -1163,14 +1200,15 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
}
|
||||
InstallerVersion v = optifine.getVersion(idx);
|
||||
File filepath = IOUtils.tryGetCanonicalFile(IOUtils.currentDirWithSeparator() + "optifine-installer.jar");
|
||||
if (v.installer != null) {
|
||||
OptiFineDownloadFormatter task = new OptiFineDownloadFormatter(v.installer);
|
||||
TaskWindow.getInstance().addTask(task)
|
||||
.addTask(new FileDownloadTask(filepath).registerPreviousResult(task).setTag("optifine"))
|
||||
.addTask(new OptiFineInstaller(profile, v.selfVersion, filepath))
|
||||
.start();
|
||||
refreshVersions();
|
||||
}
|
||||
if (v.installer != null)
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
OptiFineDownloadFormatter task = new OptiFineDownloadFormatter(v.installer);
|
||||
TaskWindow.getInstance().addTask(task)
|
||||
.addTask(new FileDownloadTask(filepath).registerPreviousResult(task).setTag("optifine"))
|
||||
.addTask(new OptiFineInstaller(profile, v.selfVersion, filepath))
|
||||
.start();
|
||||
refreshVersions();
|
||||
});
|
||||
}//GEN-LAST:event_btnDownloadOptifineActionPerformed
|
||||
|
||||
private void btnInstallLiteLoaderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInstallLiteLoaderActionPerformed
|
||||
@ -1431,6 +1469,24 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
}
|
||||
}//GEN-LAST:event_btnChoosingGameDirActionPerformed
|
||||
|
||||
private void btnMakeLaunchScriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMakeLaunchScriptActionPerformed
|
||||
MainFrame.instance.mainPanel.btnMakeLaunchCodeActionPerformed();
|
||||
}//GEN-LAST:event_btnMakeLaunchScriptActionPerformed
|
||||
|
||||
private void btnShowLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnShowLogActionPerformed
|
||||
LogWindow.instance.setVisible(true);
|
||||
}//GEN-LAST:event_btnShowLogActionPerformed
|
||||
|
||||
private void btnCleanGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanGameActionPerformed
|
||||
File f = getProfile().getMinecraftProvider().getRunDirectory(mcVersion);
|
||||
String[] dir = { "logs", "asm", "NVIDIA", "crash-reports", "server-resource-packs", "natives", "native" };
|
||||
for (String s : dir) FileUtils.deleteDirectoryQuietly(new File(f, s));
|
||||
String[] files = {"output-client.log", "usercache.json", "usernamecache.json", "hmclmc.log"};
|
||||
for (String s : files) new File(f, s).delete();
|
||||
for (MinecraftVersion s : getProfile().getMinecraftProvider().getVersions())
|
||||
FileUtils.deleteDirectoryQuietly(new File(getProfile().getGameDirFile(), "versions" + File.separator + s.id + File.separator + s.id + "-natives"));
|
||||
}//GEN-LAST:event_btnCleanGameActionPerformed
|
||||
|
||||
// </editor-fold>
|
||||
// <editor-fold defaultstate="collapsed" desc="Load">
|
||||
private void loadProfiles() {
|
||||
@ -1751,6 +1807,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
private javax.swing.JButton btnAddMod;
|
||||
private javax.swing.JButton btnChoosingGameDir;
|
||||
private javax.swing.JButton btnChoosingJavaDir;
|
||||
private javax.swing.JButton btnCleanGame;
|
||||
private javax.swing.JButton btnDownload;
|
||||
private javax.swing.JButton btnDownloadAllAssets;
|
||||
private javax.swing.JButton btnDownloadForge;
|
||||
@ -1758,6 +1815,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
private javax.swing.JButton btnExplore;
|
||||
private javax.swing.JButton btnIncludeMinecraft;
|
||||
private javax.swing.JButton btnInstallLiteLoader;
|
||||
private javax.swing.JButton btnMakeLaunchScript;
|
||||
private javax.swing.JButton btnModify;
|
||||
private javax.swing.JButton btnNewProfile;
|
||||
private javax.swing.JButton btnRefreshForge;
|
||||
@ -1767,6 +1825,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
private javax.swing.JButton btnRefreshVersions;
|
||||
private javax.swing.JButton btnRemoveMod;
|
||||
private javax.swing.JButton btnRemoveProfile;
|
||||
private javax.swing.JButton btnShowLog;
|
||||
private javax.swing.JComboBox cboGameDirType;
|
||||
private javax.swing.JComboBox cboJava;
|
||||
private javax.swing.JComboBox cboLauncherVisibility;
|
||||
|
@ -49,8 +49,6 @@
|
||||
<Component id="cboVersions" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="btnMakeLaunchScript" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="btnShowLog" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblUserName" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
@ -92,11 +90,7 @@
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlPassword" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="254" max="32767" attributes="0"/>
|
||||
<Component id="btnShowLog" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnMakeLaunchScript" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace pref="316" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -254,26 +248,6 @@
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="btnShowLog">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="mainwindow.show_log" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnShowLogActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnMakeLaunchScript">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="mainwindow.make_launch_script" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMakeLaunchScriptActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
@ -39,7 +39,6 @@ import org.jackhuang.hellominecraft.launcher.launch.LaunchScriptFinisher;
|
||||
import org.jackhuang.hellominecraft.launcher.settings.Settings;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
|
||||
import org.jackhuang.hellominecraft.utils.Event;
|
||||
import org.jackhuang.hellominecraft.views.LogWindow;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.components.ConstomButton;
|
||||
import org.jackhuang.hellominecraft.utils.functions.Consumer;
|
||||
|
||||
@ -58,8 +57,9 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
pnlButtons = new javax.swing.JPanel();
|
||||
pnlButtons.setLayout(null);
|
||||
|
||||
int w = 150, h = 50;
|
||||
btnRun = new ConstomButton();
|
||||
btnRun.setBounds(0, 0, 150, 50);
|
||||
btnRun.setBounds(0, 0, w, h);
|
||||
Font font = btnRun.getFont();
|
||||
Font newFont = new Font(font.getName(), font.getStyle(), 15);
|
||||
pnlButtons.add(btnRun);
|
||||
@ -69,7 +69,7 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
btnRun.addActionListener(e -> btnRunActionPerformed());
|
||||
|
||||
this.add(pnlButtons);
|
||||
pnlButtons.setBounds(0, 0, 150, 50);
|
||||
pnlButtons.setBounds(0, 0, w, h);
|
||||
|
||||
this.setSize(new Dimension(deWidth, deHeight));
|
||||
this.pnlButtons.setLocation(deWidth - pnlButtons.getWidth() - 25, deHeight - pnlButtons.getHeight() - 25);
|
||||
@ -104,8 +104,6 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
txtPassword = new javax.swing.JPasswordField();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
btnLogout = new javax.swing.JButton();
|
||||
btnShowLog = new javax.swing.JButton();
|
||||
btnMakeLaunchScript = new javax.swing.JButton();
|
||||
|
||||
setLayout(null);
|
||||
|
||||
@ -214,20 +212,6 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
|
||||
pnlPassword.add(jPanel3, "card3");
|
||||
|
||||
btnShowLog.setText(bundle.getString("mainwindow.show_log")); // NOI18N
|
||||
btnShowLog.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnShowLogActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnMakeLaunchScript.setText(bundle.getString("mainwindow.make_launch_script")); // NOI18N
|
||||
btnMakeLaunchScript.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnMakeLaunchScriptActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout pnlMoreLayout = new javax.swing.GroupLayout(pnlMore);
|
||||
pnlMore.setLayout(pnlMoreLayout);
|
||||
pnlMoreLayout.setHorizontalGroup(
|
||||
@ -244,8 +228,6 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
.addGroup(pnlMoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cboProfiles, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(cboVersions, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addComponent(btnMakeLaunchScript, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnShowLog, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(pnlMoreLayout.createSequentialGroup()
|
||||
.addGroup(pnlMoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblUserName)
|
||||
@ -277,11 +259,7 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 254, Short.MAX_VALUE)
|
||||
.addComponent(btnShowLog)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnMakeLaunchScript)
|
||||
.addContainerGap())
|
||||
.addContainerGap(316, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
add(pnlMore);
|
||||
@ -352,18 +330,6 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
cl.first(pnlPassword);
|
||||
}//GEN-LAST:event_btnLogoutActionPerformed
|
||||
|
||||
private void btnShowLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnShowLogActionPerformed
|
||||
LogWindow.instance.setVisible(true);
|
||||
}//GEN-LAST:event_btnShowLogActionPerformed
|
||||
|
||||
private void btnMakeLaunchScriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMakeLaunchScriptActionPerformed
|
||||
MainFrame.instance.showMessage(C.i18n("ui.message.launching"));
|
||||
genLaunchCode(value -> {
|
||||
value.successEvent.register(new LaunchScriptFinisher());
|
||||
value.successEvent.register(new PrepareAuthDoneListener());
|
||||
});
|
||||
}//GEN-LAST:event_btnMakeLaunchScriptActionPerformed
|
||||
|
||||
private void txtPlayerNameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPlayerNameKeyPressed
|
||||
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
int index = cboLoginMode.getSelectedIndex();
|
||||
@ -523,6 +489,14 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
value.successEvent.register(new PrepareAuthDoneListener());
|
||||
});
|
||||
}
|
||||
|
||||
public void btnMakeLaunchCodeActionPerformed() {
|
||||
MainFrame.instance.showMessage(C.i18n("ui.message.launching"));
|
||||
genLaunchCode(value -> {
|
||||
value.successEvent.register(new LaunchScriptFinisher());
|
||||
value.successEvent.register(new PrepareAuthDoneListener());
|
||||
});
|
||||
}
|
||||
|
||||
public void onShow(boolean showLeft) {
|
||||
if (showLeft)
|
||||
@ -544,8 +518,6 @@ public class MainPagePanel extends javax.swing.JPanel {
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnLogout;
|
||||
private javax.swing.JButton btnMakeLaunchScript;
|
||||
private javax.swing.JButton btnShowLog;
|
||||
private javax.swing.JComboBox cboLoginMode;
|
||||
private javax.swing.JComboBox cboProfiles;
|
||||
private javax.swing.JComboBox cboVersions;
|
||||
|
@ -32,7 +32,7 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
implements ProgressProviderListener, Runnable, DoingDoneListener<Task> {
|
||||
|
||||
private static final TaskWindow instance = new TaskWindow();
|
||||
|
||||
|
||||
public static TaskWindow getInstance() {
|
||||
instance.clean();
|
||||
return instance;
|
||||
@ -67,8 +67,7 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
if (isVisible())
|
||||
throw new RuntimeException("This error should not appear, please contact the author.");
|
||||
if (isVisible()) return;
|
||||
taskList = null;
|
||||
taskList = new TaskList();
|
||||
taskList.addTaskListener(this);
|
||||
@ -163,6 +162,7 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
}//GEN-LAST:event_btnCancelActionPerformed
|
||||
|
||||
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
|
||||
if(taskList == null) return;
|
||||
tasks.clear();
|
||||
|
||||
if (!this.failReasons.isEmpty()) {
|
||||
@ -171,8 +171,7 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
}
|
||||
|
||||
if (!suc) {
|
||||
if (taskList != null)
|
||||
SwingUtilities.invokeLater(taskList::abort);
|
||||
SwingUtilities.invokeLater(taskList::abort);
|
||||
HMCLog.log("Tasks have been canceled by user.");
|
||||
}
|
||||
}//GEN-LAST:event_formWindowClosed
|
||||
|
@ -24,7 +24,7 @@ import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class ConstomButton extends javax.swing.JButton {
|
||||
public Color normalFg = GraphicsUtils.getWebColorWithAlpha("DDDDDD3F"), normalBg = GraphicsUtils.getWebColorWithAlpha("DDDDDD3F"),
|
||||
public Color normalFg = GraphicsUtils.getWebColorWithAlpha("DDDDDD6F"), normalBg = GraphicsUtils.getWebColorWithAlpha("DDDDDD6F"),
|
||||
prelightFg = GraphicsUtils.getWebColorWithAlpha("FFFFFF7F"), prelightBg = GraphicsUtils.getWebColorWithAlpha("FFFFFF7F"),
|
||||
activeFg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F"), activeBg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F");
|
||||
public int drawPercent = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user