Now have a choosing pane for java directory.

This commit is contained in:
huanghongxun 2015-07-28 20:50:31 +08:00
parent e31b5e3a28
commit c3008ec294
7 changed files with 546 additions and 488 deletions

File diff suppressed because it is too large Load Diff

View File

@ -299,12 +299,6 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cboGameDirType" alignment="1" max="32767" attributes="0"/>
<Component id="cboLauncherVisibility" alignment="1" max="32767" attributes="0"/>
<Component id="txtJavaDir" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="txtMaxMemory" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="lblMaxMemory" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="txtGameDir" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="txtWidth" min="-2" pref="100" max="-2" attributes="0"/>
@ -315,6 +309,17 @@
<EmptySpace pref="306" max="32767" attributes="0"/>
<Component id="chkFullscreen" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtMaxMemory" max="32767" attributes="0"/>
<Component id="txtJavaDir" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btnChoosingJavaDir" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="lblMaxMemory" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</Group>
@ -334,6 +339,7 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtJavaDir" alignment="3" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnChoosingJavaDir" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@ -490,6 +496,16 @@
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="cboGameDirTypeFocusLost"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnChoosingJavaDir">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="ui.button.explore" 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="btnChoosingJavaDirActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">

View File

@ -21,6 +21,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -200,6 +201,7 @@ public class GameSettingsPanel extends javax.swing.JPanel {
jLabel10 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
cboGameDirType = new javax.swing.JComboBox();
btnChoosingJavaDir = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
chkDebug = new javax.swing.JCheckBox();
jLabel26 = new javax.swing.JLabel();
@ -460,6 +462,13 @@ public class GameSettingsPanel extends javax.swing.JPanel {
}
});
btnChoosingJavaDir.setText(bundle.getString("ui.button.explore")); // NOI18N
btnChoosingJavaDir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnChoosingJavaDirActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
jPanel22.setLayout(jPanel22Layout);
jPanel22Layout.setHorizontalGroup(
@ -482,11 +491,6 @@ public class GameSettingsPanel extends javax.swing.JPanel {
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cboGameDirType, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cboLauncherVisibility, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtJavaDir, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel22Layout.createSequentialGroup()
.addComponent(txtMaxMemory)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblMaxMemory))
.addComponent(txtGameDir)
.addGroup(jPanel22Layout.createSequentialGroup()
.addComponent(txtWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -495,7 +499,15 @@ public class GameSettingsPanel extends javax.swing.JPanel {
.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, 306, Short.MAX_VALUE)
.addComponent(chkFullscreen)))))
.addComponent(chkFullscreen))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel22Layout.createSequentialGroup()
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtMaxMemory)
.addComponent(txtJavaDir))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnChoosingJavaDir, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblMaxMemory, javax.swing.GroupLayout.Alignment.TRAILING))))))
.addContainerGap())
);
jPanel22Layout.setVerticalGroup(
@ -508,7 +520,8 @@ public class GameSettingsPanel extends javax.swing.JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtJavaDir, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11))
.addComponent(jLabel11)
.addComponent(btnChoosingJavaDir))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblMaxMemory)
@ -1145,6 +1158,24 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
loadVersions();
}//GEN-LAST:event_txtGameDirFocusLost
private void btnChoosingJavaDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChoosingJavaDirActionPerformed
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setDialogTitle(C.i18n("settings.choose_javapath"));
fc.setMultiSelectionEnabled(false);
fc.showOpenDialog(this);
if (fc.getSelectedFile() == null)
return;
try {
String path = fc.getSelectedFile().getCanonicalPath();
txtJavaDir.setText(path);
profile.setJavaDir(txtJavaDir.getText());
} catch (IOException e) {
HMCLog.warn("Failed to set background path.", e);
MessageBox.Show(C.i18n("ui.label.failed_set") + e.getMessage());
}
}//GEN-LAST:event_btnChoosingJavaDirActionPerformed
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Load">
private void loadProfiles() {
@ -1400,6 +1431,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
// <editor-fold defaultstate="collapsed" desc="UI Definations">
JPopupMenu ppmManage, ppmExplore;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnChoosingJavaDir;
private javax.swing.JButton btnDownload;
private javax.swing.JButton btnDownloadAllAssets;
private javax.swing.JButton btnDownloadForge;

View File

@ -191,6 +191,7 @@ settings.dimension=\u5206\u8fa8\u7387
settings.fullscreen=\u5168\u5c4f
settings.update_version=\u66f4\u65b0\u7248\u672c\u6587\u4ef6
settings.physical_memory=\u7269\u7406\u5185\u5b58\u5927\u5c0f
settings.choose_javapath=\u9009\u62e9Java\u8def\u5f84
settings.failed_load=\u8bbe\u7f6e\u6587\u4ef6\u52a0\u8f7d\u5931\u8d25\uff0c\u53ef\u80fd\u662f\u5347\u7ea7\u4e86\u542f\u52a8\u5668\u6216\u88ab\u4eba\u5de5\u4fee\u6539\u9020\u6210\u9519\u8bef\uff0c\u662f\u5426\u6e05\u9664\uff1f

View File

@ -186,6 +186,7 @@ settings.dimension=Dimension
settings.fullscreen=Fullscreen
settings.update_version=Update version json.
settings.physical_memory=Physical Memory Size
settings.choose_javapath=Choose Java Directory.
settings.failed_load=Failed to load settings file. Remove it?

View File

@ -186,6 +186,7 @@ settings.dimension=\u5206\u8fa8\u7387
settings.fullscreen=\u5168\u5c4f
settings.update_version=\u66f4\u65b0\u7248\u672c\u6587\u4ef6
settings.physical_memory=\u7269\u7406\u5185\u5b58\u5927\u5c0f
settings.choose_javapath=\u9009\u62e9Java\u8def\u5f84
settings.failed_load=\u8bbe\u7f6e\u6587\u4ef6\u52a0\u8f7d\u5931\u8d25\uff0c\u53ef\u80fd\u662f\u5347\u7ea7\u4e86\u542f\u52a8\u5668\u6216\u88ab\u4eba\u5de5\u4fee\u6539\u9020\u6210\u9519\u8bef\uff0c\u662f\u5426\u6e05\u9664\uff1f

View File

@ -186,6 +186,7 @@ settings.dimension=\u5206\u8fa8\u7387
settings.fullscreen=\u5168\u5c4f
settings.update_version=\u66f4\u65b0\u7248\u672c\u6587\u4ef6
settings.physical_memory=\u7269\u7406\u5185\u5b58\u5927\u5c0f
settings.choose_javapath=\u9009\u62e9Java\u8def\u5f84
settings.failed_load=\u8a2d\u5b9a\u6587\u4ef6\u52a0\u8f09\u5931\u6557\uff0c\u53ef\u80fd\u662f\u5347\u7d1a\u4e86\u555f\u52d5\u5668\u6216\u88ab\u4eba\u5de5\u4fee\u6539\u9020\u6210\u932f\u8aa4\uff0c\u662f\u5426\u6e05\u9664\uff1f