Redesign the UI.

This commit is contained in:
huanghongxun
2015-08-31 21:06:35 +08:00
parent 981a11d98b
commit f9968580af
9 changed files with 154 additions and 107 deletions

View File

@@ -25,7 +25,7 @@ if (!hasProperty('mainClass')) {
ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main' 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 mavenGroupId = 'HMCL'
String mavenVersion = '2.3.5' + buildnumber String mavenVersion = '2.3.5' + buildnumber

View File

@@ -100,7 +100,7 @@ public final class Main implements Runnable {
} }
public static String launcherName = "Hello Minecraft! Launcher"; 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; public static int minimumLauncherVersion = 16;
/** /**

View File

@@ -89,7 +89,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
if (enableLogger) HMCLog.err(text); if (enableLogger) HMCLog.err(text);
else System.out.println(text); else System.out.println(text);
if (!checkThrowable(e)) { if (checkThrowable(e)) {
SwingUtilities.invokeLater(() -> LogWindow.instance.showAsCrashWindow(UpdateChecker.OUT_DATED)); SwingUtilities.invokeLater(() -> LogWindow.instance.showAsCrashWindow(UpdateChecker.OUT_DATED));
if (!UpdateChecker.OUT_DATED) if (!UpdateChecker.OUT_DATED)
reportToServer(text, s); reportToServer(text, s);

View File

@@ -22,12 +22,22 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" 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"/> <EmptySpace max="-2" attributes="0"/>
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group> </Group>
<Component id="tabVersionEdit" alignment="0" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
@@ -37,7 +47,12 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="tabVersionEdit" max="32767" attributes="0"/> <Component id="tabVersionEdit" max="32767" attributes="0"/>
<EmptySpace max="-2" 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"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@@ -91,7 +106,7 @@
<Component id="jLabel9" min="-2" max="-2" attributes="0"/> <Component id="jLabel9" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="txtHeight" min="-2" pref="100" 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"/> <Component id="chkFullscreen" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
@@ -535,7 +550,7 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="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"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="btnRemoveMod" min="-2" max="-2" attributes="0"/> <Component id="btnRemoveMod" min="-2" max="-2" attributes="0"/>
@@ -672,7 +687,7 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" 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"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="btnDownloadForge" alignment="0" max="32767" attributes="0"/> <Component id="btnDownloadForge" alignment="0" max="32767" attributes="0"/>
@@ -752,7 +767,7 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="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"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="btnDownloadOptifine" max="32767" attributes="0"/> <Component id="btnDownloadOptifine" max="32767" attributes="0"/>
@@ -832,7 +847,7 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="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"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="btnInstallLiteLoader" alignment="0" max="32767" attributes="0"/> <Component id="btnInstallLiteLoader" alignment="0" max="32767" attributes="0"/>
@@ -918,7 +933,7 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="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"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="btnRefreshGameDownloads" alignment="0" max="32767" 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"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnIncludeMinecraftActionPerformed"/>
</Events> </Events>
</Component> </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(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</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(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</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="&#x6e05;&#x7406;&#x6e38;&#x620f;&#x6587;&#x4ef6;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCleanGameActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@@ -80,6 +80,7 @@ import org.jackhuang.hellominecraft.utils.system.FileUtils;
import org.jackhuang.hellominecraft.utils.system.Java; import org.jackhuang.hellominecraft.utils.system.Java;
import org.jackhuang.hellominecraft.version.MinecraftRemoteVersion; import org.jackhuang.hellominecraft.version.MinecraftRemoteVersion;
import org.jackhuang.hellominecraft.version.MinecraftRemoteVersions; import org.jackhuang.hellominecraft.version.MinecraftRemoteVersions;
import org.jackhuang.hellominecraft.views.LogWindow;
import org.jackhuang.hellominecraft.views.Selector; import org.jackhuang.hellominecraft.views.Selector;
/** /**
@@ -338,6 +339,9 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
btnRemoveProfile = new javax.swing.JButton(); btnRemoveProfile = new javax.swing.JButton();
btnExplore = new javax.swing.JButton(); btnExplore = new javax.swing.JButton();
btnIncludeMinecraft = 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)); setBackground(new java.awt.Color(255, 255, 255));
@@ -468,7 +472,7 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
.addComponent(jLabel9) .addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .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)) .addComponent(chkFullscreen))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel22Layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel22Layout.createSequentialGroup()
.addComponent(txtMaxMemory) .addComponent(txtMaxMemory)
@@ -692,7 +696,7 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
jPanel7Layout.setHorizontalGroup( jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup() .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnRemoveMod) .addComponent(btnRemoveMod)
@@ -756,7 +760,7 @@ public class GameSettingsPanel extends javax.swing.JPanel implements DropTargetL
jPanel16Layout.setHorizontalGroup( jPanel16Layout.setHorizontalGroup(
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup() .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnDownloadForge, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .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.setHorizontalGroup(
pnlOptifineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) pnlOptifineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlOptifineLayout.createSequentialGroup() .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlOptifineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(pnlOptifineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnDownloadOptifine, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .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.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup() .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnInstallLiteLoader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .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.setHorizontalGroup(
pnlGameDownloadsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) pnlGameDownloadsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlGameDownloadsLayout.createSequentialGroup() .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlGameDownloadsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(pnlGameDownloadsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnRefreshGameDownloads, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .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); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnIncludeMinecraft) .addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()
.addComponent(tabVersionEdit) .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.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1080,7 +1113,11 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tabVersionEdit) .addComponent(tabVersionEdit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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()) .addContainerGap())
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@@ -1163,14 +1200,15 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
} }
InstallerVersion v = optifine.getVersion(idx); InstallerVersion v = optifine.getVersion(idx);
File filepath = IOUtils.tryGetCanonicalFile(IOUtils.currentDirWithSeparator() + "optifine-installer.jar"); File filepath = IOUtils.tryGetCanonicalFile(IOUtils.currentDirWithSeparator() + "optifine-installer.jar");
if (v.installer != null) { if (v.installer != null)
OptiFineDownloadFormatter task = new OptiFineDownloadFormatter(v.installer); SwingUtilities.invokeLater(() -> {
TaskWindow.getInstance().addTask(task) OptiFineDownloadFormatter task = new OptiFineDownloadFormatter(v.installer);
.addTask(new FileDownloadTask(filepath).registerPreviousResult(task).setTag("optifine")) TaskWindow.getInstance().addTask(task)
.addTask(new OptiFineInstaller(profile, v.selfVersion, filepath)) .addTask(new FileDownloadTask(filepath).registerPreviousResult(task).setTag("optifine"))
.start(); .addTask(new OptiFineInstaller(profile, v.selfVersion, filepath))
refreshVersions(); .start();
} refreshVersions();
});
}//GEN-LAST:event_btnDownloadOptifineActionPerformed }//GEN-LAST:event_btnDownloadOptifineActionPerformed
private void btnInstallLiteLoaderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInstallLiteLoaderActionPerformed 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 }//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>
// <editor-fold defaultstate="collapsed" desc="Load"> // <editor-fold defaultstate="collapsed" desc="Load">
private void loadProfiles() { private void loadProfiles() {
@@ -1751,6 +1807,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
private javax.swing.JButton btnAddMod; private javax.swing.JButton btnAddMod;
private javax.swing.JButton btnChoosingGameDir; private javax.swing.JButton btnChoosingGameDir;
private javax.swing.JButton btnChoosingJavaDir; private javax.swing.JButton btnChoosingJavaDir;
private javax.swing.JButton btnCleanGame;
private javax.swing.JButton btnDownload; private javax.swing.JButton btnDownload;
private javax.swing.JButton btnDownloadAllAssets; private javax.swing.JButton btnDownloadAllAssets;
private javax.swing.JButton btnDownloadForge; 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 btnExplore;
private javax.swing.JButton btnIncludeMinecraft; private javax.swing.JButton btnIncludeMinecraft;
private javax.swing.JButton btnInstallLiteLoader; private javax.swing.JButton btnInstallLiteLoader;
private javax.swing.JButton btnMakeLaunchScript;
private javax.swing.JButton btnModify; private javax.swing.JButton btnModify;
private javax.swing.JButton btnNewProfile; private javax.swing.JButton btnNewProfile;
private javax.swing.JButton btnRefreshForge; 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 btnRefreshVersions;
private javax.swing.JButton btnRemoveMod; private javax.swing.JButton btnRemoveMod;
private javax.swing.JButton btnRemoveProfile; private javax.swing.JButton btnRemoveProfile;
private javax.swing.JButton btnShowLog;
private javax.swing.JComboBox cboGameDirType; private javax.swing.JComboBox cboGameDirType;
private javax.swing.JComboBox cboJava; private javax.swing.JComboBox cboJava;
private javax.swing.JComboBox cboLauncherVisibility; private javax.swing.JComboBox cboLauncherVisibility;

View File

@@ -49,8 +49,6 @@
<Component id="cboVersions" alignment="0" max="32767" attributes="0"/> <Component id="cboVersions" alignment="0" max="32767" attributes="0"/>
</Group> </Group>
</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="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="lblUserName" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lblUserName" alignment="0" min="-2" max="-2" attributes="0"/>
@@ -92,11 +90,7 @@
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="pnlPassword" min="-2" pref="26" max="-2" attributes="0"/> <Component id="pnlPassword" min="-2" pref="26" max="-2" attributes="0"/>
<EmptySpace pref="254" max="32767" attributes="0"/> <EmptySpace pref="316" 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"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@@ -254,26 +248,6 @@
</Container> </Container>
</SubComponents> </SubComponents>
</Container> </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(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</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(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMakeLaunchScriptActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
</SubComponents> </SubComponents>

View File

@@ -39,7 +39,6 @@ import org.jackhuang.hellominecraft.launcher.launch.LaunchScriptFinisher;
import org.jackhuang.hellominecraft.launcher.settings.Settings; import org.jackhuang.hellominecraft.launcher.settings.Settings;
import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils; import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
import org.jackhuang.hellominecraft.utils.Event; import org.jackhuang.hellominecraft.utils.Event;
import org.jackhuang.hellominecraft.views.LogWindow;
import org.jackhuang.hellominecraft.lookandfeel.components.ConstomButton; import org.jackhuang.hellominecraft.lookandfeel.components.ConstomButton;
import org.jackhuang.hellominecraft.utils.functions.Consumer; import org.jackhuang.hellominecraft.utils.functions.Consumer;
@@ -58,8 +57,9 @@ public class MainPagePanel extends javax.swing.JPanel {
pnlButtons = new javax.swing.JPanel(); pnlButtons = new javax.swing.JPanel();
pnlButtons.setLayout(null); pnlButtons.setLayout(null);
int w = 150, h = 50;
btnRun = new ConstomButton(); btnRun = new ConstomButton();
btnRun.setBounds(0, 0, 150, 50); btnRun.setBounds(0, 0, w, h);
Font font = btnRun.getFont(); Font font = btnRun.getFont();
Font newFont = new Font(font.getName(), font.getStyle(), 15); Font newFont = new Font(font.getName(), font.getStyle(), 15);
pnlButtons.add(btnRun); pnlButtons.add(btnRun);
@@ -69,7 +69,7 @@ public class MainPagePanel extends javax.swing.JPanel {
btnRun.addActionListener(e -> btnRunActionPerformed()); btnRun.addActionListener(e -> btnRunActionPerformed());
this.add(pnlButtons); this.add(pnlButtons);
pnlButtons.setBounds(0, 0, 150, 50); pnlButtons.setBounds(0, 0, w, h);
this.setSize(new Dimension(deWidth, deHeight)); this.setSize(new Dimension(deWidth, deHeight));
this.pnlButtons.setLocation(deWidth - pnlButtons.getWidth() - 25, deHeight - pnlButtons.getHeight() - 25); 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(); txtPassword = new javax.swing.JPasswordField();
jPanel3 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel();
btnLogout = new javax.swing.JButton(); btnLogout = new javax.swing.JButton();
btnShowLog = new javax.swing.JButton();
btnMakeLaunchScript = new javax.swing.JButton();
setLayout(null); setLayout(null);
@@ -214,20 +212,6 @@ public class MainPagePanel extends javax.swing.JPanel {
pnlPassword.add(jPanel3, "card3"); 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); javax.swing.GroupLayout pnlMoreLayout = new javax.swing.GroupLayout(pnlMore);
pnlMore.setLayout(pnlMoreLayout); pnlMore.setLayout(pnlMoreLayout);
pnlMoreLayout.setHorizontalGroup( pnlMoreLayout.setHorizontalGroup(
@@ -244,8 +228,6 @@ public class MainPagePanel extends javax.swing.JPanel {
.addGroup(pnlMoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cboProfiles, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cboProfiles, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cboVersions, 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.createSequentialGroup()
.addGroup(pnlMoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblUserName) .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)) .addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnlPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnlPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 254, Short.MAX_VALUE) .addContainerGap(316, Short.MAX_VALUE))
.addComponent(btnShowLog)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnMakeLaunchScript)
.addContainerGap())
); );
add(pnlMore); add(pnlMore);
@@ -352,18 +330,6 @@ public class MainPagePanel extends javax.swing.JPanel {
cl.first(pnlPassword); cl.first(pnlPassword);
}//GEN-LAST:event_btnLogoutActionPerformed }//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 private void txtPlayerNameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPlayerNameKeyPressed
if (evt.getKeyCode() == KeyEvent.VK_ENTER) { if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
int index = cboLoginMode.getSelectedIndex(); int index = cboLoginMode.getSelectedIndex();
@@ -523,6 +489,14 @@ public class MainPagePanel extends javax.swing.JPanel {
value.successEvent.register(new PrepareAuthDoneListener()); 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) { public void onShow(boolean showLeft) {
if (showLeft) if (showLeft)
@@ -544,8 +518,6 @@ public class MainPagePanel extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnLogout; private javax.swing.JButton btnLogout;
private javax.swing.JButton btnMakeLaunchScript;
private javax.swing.JButton btnShowLog;
private javax.swing.JComboBox cboLoginMode; private javax.swing.JComboBox cboLoginMode;
private javax.swing.JComboBox cboProfiles; private javax.swing.JComboBox cboProfiles;
private javax.swing.JComboBox cboVersions; private javax.swing.JComboBox cboVersions;

View File

@@ -32,7 +32,7 @@ public class TaskWindow extends javax.swing.JDialog
implements ProgressProviderListener, Runnable, DoingDoneListener<Task> { implements ProgressProviderListener, Runnable, DoingDoneListener<Task> {
private static final TaskWindow instance = new TaskWindow(); private static final TaskWindow instance = new TaskWindow();
public static TaskWindow getInstance() { public static TaskWindow getInstance() {
instance.clean(); instance.clean();
return instance; return instance;
@@ -67,8 +67,7 @@ public class TaskWindow extends javax.swing.JDialog
} }
public void clean() { public void clean() {
if (isVisible()) if (isVisible()) return;
throw new RuntimeException("This error should not appear, please contact the author.");
taskList = null; taskList = null;
taskList = new TaskList(); taskList = new TaskList();
taskList.addTaskListener(this); taskList.addTaskListener(this);
@@ -163,6 +162,7 @@ public class TaskWindow extends javax.swing.JDialog
}//GEN-LAST:event_btnCancelActionPerformed }//GEN-LAST:event_btnCancelActionPerformed
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
if(taskList == null) return;
tasks.clear(); tasks.clear();
if (!this.failReasons.isEmpty()) { if (!this.failReasons.isEmpty()) {
@@ -171,8 +171,7 @@ public class TaskWindow extends javax.swing.JDialog
} }
if (!suc) { if (!suc) {
if (taskList != null) SwingUtilities.invokeLater(taskList::abort);
SwingUtilities.invokeLater(taskList::abort);
HMCLog.log("Tasks have been canceled by user."); HMCLog.log("Tasks have been canceled by user.");
} }
}//GEN-LAST:event_formWindowClosed }//GEN-LAST:event_formWindowClosed

View File

@@ -24,7 +24,7 @@ import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
* @author huangyuhui * @author huangyuhui
*/ */
public class ConstomButton extends javax.swing.JButton { 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"), prelightFg = GraphicsUtils.getWebColorWithAlpha("FFFFFF7F"), prelightBg = GraphicsUtils.getWebColorWithAlpha("FFFFFF7F"),
activeFg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F"), activeBg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F"); activeFg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F"), activeBg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F");
public int drawPercent = 0; public int drawPercent = 0;