Commit df3c35e4 authored by superblaubeere27's avatar superblaubeere27

Fixed mod saving, deactivated censoring (debugging), add transations

parent 160c4ae8
......@@ -23,9 +23,7 @@ import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.*;
import java.util.List;
import java.util.logging.Handler;
import java.util.logging.Level;
......@@ -205,7 +203,7 @@ public class LiquidLauncher {
} catch (Exception e) {
if (DEVEL_VERSION) {
clientBuilds = new ArrayList<>();
clientBuilds.add(new ClientBuild("", "", "", "100.200", "b18.88", ""));
clientBuilds.add(new ClientBuild("", "", "", "1.8.9", "b26.2", "54beaca4e07fe665676048227408c498"));
}
fatalError("Failed to load LiquidBounce versions: " + e);
}
......@@ -273,7 +271,7 @@ public class LiquidLauncher {
throw new LaunchException("Failed to install LiquidBounce");
if (!tree.getForgeJar().exists())
NetworkUtils.downloadWithProgressBarUpdate("Waiting...", clientBuild.getForgeVersion(), tree.getForgeJar(), menuInterface.progress, "Downloading forge...");
NetworkUtils.downloadWithProgressBarUpdate(ResourceBundle.getBundle("tanslations").getString("waiting"), clientBuild.getForgeVersion(), tree.getForgeJar(), menuInterface.progress, "Downloading forge...");
if (!tree.getForgeJson().exists()) {
final ZipFile forgeFile = new ZipFile(tree.getForgeJar());
......@@ -284,15 +282,15 @@ public class LiquidLauncher {
if (!tree.getMinecraftJson().exists()) {
menuInterface.progress.setString("Loading minecraft JSON...");
final String minecraftJsonDownload = getMCJson(clientBuild.getMinecraftVersion());
NetworkUtils.downloadWithProgressBarUpdate("Waiting...", minecraftJsonDownload, tree.getMinecraftJson(), menuInterface.progress, "Downloading client JSON...");
menuInterface.progress.setString("Waiting...");
NetworkUtils.downloadWithProgressBarUpdate(ResourceBundle.getBundle("tanslations").getString("waiting"), minecraftJsonDownload, tree.getMinecraftJson(), menuInterface.progress, "Downloading client JSON...");
menuInterface.progress.setString(ResourceBundle.getBundle("tanslations").getString("waiting"));
}
if (!tree.getMinecraftJar().exists()) {
final JsonObject mcJ = jsonParser.parse(new InputStreamReader(new FileInputStream(tree.getMinecraftJson()))).getAsJsonObject();
if (mcJ.has("downloads") && mcJ.getAsJsonObject("downloads").has("client") && mcJ.getAsJsonObject("downloads").getAsJsonObject("client").has("url")) {
String downloadUrl = mcJ.getAsJsonObject("downloads").getAsJsonObject("client").get("url").getAsString();
NetworkUtils.downloadWithProgressBarUpdate("Waiting...", downloadUrl, tree.getMinecraftJar(), menuInterface.progress, "Downloading client Jar...");
NetworkUtils.downloadWithProgressBarUpdate(ResourceBundle.getBundle("tanslations").getString("waiting"), downloadUrl, tree.getMinecraftJar(), menuInterface.progress, "Downloading client Jar...");
} else {
tree.getMinecraftJson().delete();
throw new LaunchException("The minecraft json is not valid!");
......@@ -401,7 +399,7 @@ public class LiquidLauncher {
e.printStackTrace();
JOptionPane.showMessageDialog(menuInterface, "Failed to launch client: " + e, "Failed to launch client", JOptionPane.WARNING_MESSAGE);
} finally {
menuInterface.progress.setString("Waiting...");
menuInterface.progress.setString(ResourceBundle.getBundle("tanslations").getString("waiting"));
menuInterface.launchButton.setEnabled(!launched);
}
}, "Launch thread").start();
......@@ -447,7 +445,7 @@ public class LiquidLauncher {
}
menuInterface.launchButton.setText("Play");
menuInterface.launchButton.setEnabled(true);
menuInterface.progress.setString("Waiting...");
menuInterface.progress.setString(ResourceBundle.getBundle("tanslations").getString("waiting"));
menuInterface.progress.setValue(0);
menuInterface.progress.setIndeterminate(false);
}).start();
......
......@@ -11,13 +11,14 @@ import java.net.MalformedURLException;
public class Main {
public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (final Exception ignored) {
Thread t = new Thread(() -> {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (final Exception ignored) {
}
}
// JavaFX installed check
// JavaFX installed check
// try {
// Class.forName("com.sun.javafx.application.PlatformImpl");
// Class.forName("javafx.embed.swing.JFXPanel");
......@@ -27,12 +28,14 @@ public class Main {
// return;
// }
try {
final LiquidLauncher liquidLauncher = new LiquidLauncher();
liquidLauncher.start();
} catch (final MalformedURLException e) {
e.printStackTrace();
}
try {
final LiquidLauncher liquidLauncher = new LiquidLauncher();
liquidLauncher.start();
} catch (final MalformedURLException e) {
e.printStackTrace();
}
}, "LLThread");
t.start();
}
}
package net.ccbluex.LiquidLauncher.config;
import com.google.common.io.ByteStreams;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import net.ccbluex.LiquidLauncher.LiquidLauncher;
import net.ccbluex.LiquidLauncher.launch.mods.Mod;
import net.ccbluex.LiquidLauncher.ui.MenuInterface;
import net.ccbluex.LiquidLauncher.utils.AuthenticationUtils;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
......@@ -31,6 +35,8 @@ public class Settings {
private final static String ACCOUNT = "account";
private final static String LATEST_VERSION = "latestVersion";
private final static String JVM_PATH = "jvmPath";
private final static String VERSIONS = "versions";
private final static String MODS = "mods";
public static void save(final File file) {
final MenuInterface menuInterface = LiquidLauncher.liquidLauncher.menuInterface;
......@@ -55,6 +61,27 @@ public class Settings {
jsonObject.addProperty(LATEST_VERSION, menuInterface.getAlwaysLatest().isSelected());
jsonObject.addProperty(JVM_PATH, menuInterface.getJvmPath().getText());
JsonArray versions = new JsonArray();
for (String s :
LiquidLauncher.liquidLauncher.getMinecraftVersions()) {
JsonObject version = new JsonObject();
version.addProperty("name", s);
if (LiquidLauncher.liquidLauncher.versionMods.containsKey(s)) {
JsonArray mods = new JsonArray();
for (Mod mod :
LiquidLauncher.liquidLauncher.versionMods.get(s)) {
JsonObject modObject = new JsonObject();
modObject.addProperty("activated", mod.isActivated());
modObject.addProperty("name", mod.getName());
modObject.addProperty("path", mod.getPath());
mods.add(modObject);
}
version.add("mods", mods);
}
versions.add(version);
}
jsonObject.add("versions", versions);
if (menuInterface.getRememberMeCheckBox().isSelected()) {
// TODO Only save session
final JsonObject accountObject = new JsonObject();
......@@ -103,7 +130,26 @@ public class Settings {
menuInterface.getJvmArgumentsField().setText(jsonObject.get(JVM_ARGS).getAsString());
if (jsonObject.has(JVM_PATH))
menuInterface.getJvmPath().setText(jsonObject.get(JVM_PATH).getAsString());
if (jsonObject.has("versions")) {
for (JsonElement versionElement :
jsonObject.getAsJsonArray("versions")) {
JsonObject version = (JsonObject) versionElement;
String name = version.get("name").getAsString();
if (version.has("mods")) {
JsonArray mods = version.getAsJsonArray("mods");
List<Mod> modList = new ArrayList<Mod>();
for (JsonElement modElement :
mods) {
JsonObject mod = (JsonObject) modElement;
String modName = mod.get("name").getAsString();
String modPath = mod.get("path").getAsString();
boolean modActivated = mod.get("activated").getAsBoolean();
modList.add(new Mod(modName, modPath, modActivated));
}
LiquidLauncher.liquidLauncher.versionMods.put(name, modList);
}
}
}
if (jsonObject.has(MC_VERSION)) {
final String selectedMinecraftVersion = jsonObject.get(MC_VERSION).getAsString();
......
......@@ -46,7 +46,8 @@ public class GameProcess {
}
private String censor(final String line) {
return clazzPattern.matcher(line).replaceAll("<CENSORED>");
// return clazzPattern.matcher(line).replaceAll("<CENSORED>");
return line;
}
public Process getProcess() {
......
......@@ -34,7 +34,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="OK"/>
<text resource-bundle="tanslations" key="ok"/>
</properties>
</component>
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
......@@ -42,7 +42,7 @@
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Cancel"/>
<text resource-bundle="tanslations" key="cancel"/>
</properties>
</component>
</children>
......@@ -62,7 +62,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&lt;html&gt;Please download LiquidBounce from the download page: &lt;input value=&quot;%download%&quot;&gt;&lt;/input&gt; Please do &lt;strong&gt;NOT&lt;/strong&gt; extract the zip file!&lt;/html&gt;"/>
<text resource-bundle="tanslations" key="liquidBounceDownloadLabel"/>
</properties>
<clientProperties>
<html.disable class="java.lang.Boolean" value="false"/>
......@@ -86,7 +86,7 @@
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Browse"/>
<text resource-bundle="tanslations" key="browse"/>
</properties>
</component>
<component id="d515" class="javax.swing.JLabel">
......@@ -94,7 +94,7 @@
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Or drag and drop the file into this frame"/>
<text resource-bundle="tanslations" key="liquidBounceDnD"/>
</properties>
</component>
</children>
......@@ -105,7 +105,7 @@
</constraints>
<properties>
<font size="48"/>
<text value="Add LiquidBounce"/>
<text resource-bundle="tanslations" key="addLiquidBounce"/>
</properties>
</component>
</children>
......
......@@ -21,6 +21,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.util.List;
import java.util.ResourceBundle;
public class AddLiquidBounceDialog extends JDialog {
......@@ -213,16 +214,16 @@ public class AddLiquidBounceDialog extends JDialog {
panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false));
panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
buttonOK = new JButton();
buttonOK.setText("OK");
this.$$$loadButtonText$$$(buttonOK, ResourceBundle.getBundle("tanslations").getString("ok"));
panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
buttonCancel = new JButton();
buttonCancel.setText("Cancel");
this.$$$loadButtonText$$$(buttonCancel, ResourceBundle.getBundle("tanslations").getString("cancel"));
panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
dlLabel = new JLabel();
dlLabel.setText("<html>Please download LiquidBounce from the download page: <input value=\"%download%\"></input> Please do <strong>NOT</strong> extract the zip file!</html>");
this.$$$loadLabelText$$$(dlLabel, ResourceBundle.getBundle("tanslations").getString("liquidBounceDownloadLabel"));
dlLabel.putClientProperty("html.disable", Boolean.FALSE);
panel3.add(dlLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
......@@ -230,17 +231,71 @@ public class AddLiquidBounceDialog extends JDialog {
fileField = new JTextField();
panel3.add(fileField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
browseButton = new JButton();
browseButton.setText("Browse");
this.$$$loadButtonText$$$(browseButton, ResourceBundle.getBundle("tanslations").getString("browse"));
panel3.add(browseButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label1 = new JLabel();
label1.setText("Or drag and drop the file into this frame");
this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("tanslations").getString("liquidBounceDnD"));
panel3.add(label1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label2 = new JLabel();
label2.setFont(new Font(label2.getFont().getName(), label2.getFont().getStyle(), 48));
label2.setText("Add LiquidBounce");
this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("tanslations").getString("addLiquidBounce"));
contentPane.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
/**
* @noinspection ALL
*/
private void $$$loadLabelText$$$(JLabel component, String text) {
StringBuffer result = new StringBuffer();
boolean haveMnemonic = false;
char mnemonic = '\0';
int mnemonicIndex = -1;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '&') {
i++;
if (i == text.length()) break;
if (!haveMnemonic && text.charAt(i) != '&') {
haveMnemonic = true;
mnemonic = text.charAt(i);
mnemonicIndex = result.length();
}
}
result.append(text.charAt(i));
}
component.setText(result.toString());
if (haveMnemonic) {
component.setDisplayedMnemonic(mnemonic);
component.setDisplayedMnemonicIndex(mnemonicIndex);
}
}
/**
* @noinspection ALL
*/
private void $$$loadButtonText$$$(AbstractButton component, String text) {
StringBuffer result = new StringBuffer();
boolean haveMnemonic = false;
char mnemonic = '\0';
int mnemonicIndex = -1;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '&') {
i++;
if (i == text.length()) break;
if (!haveMnemonic && text.charAt(i) != '&') {
haveMnemonic = true;
mnemonic = text.charAt(i);
mnemonicIndex = result.length();
}
}
result.append(text.charAt(i));
}
component.setText(result.toString());
if (haveMnemonic) {
component.setMnemonic(mnemonic);
component.setDisplayedMnemonicIndex(mnemonicIndex);
}
}
/**
* @noinspection ALL
*/
......
......@@ -3,7 +3,7 @@
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="436" height="297"/>
<xy x="48" y="54" width="507" height="297"/>
</constraints>
<properties/>
<border type="none"/>
......@@ -34,7 +34,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="OK"/>
<text resource-bundle="tanslations" key="ok"/>
</properties>
</component>
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
......@@ -42,7 +42,7 @@
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Cancel"/>
<text resource-bundle="tanslations" key="cancel"/>
</properties>
</component>
</children>
......@@ -68,7 +68,7 @@
</constraints>
<properties>
<font size="48"/>
<text value="Add Mod"/>
<text resource-bundle="tanslations" key="addMod"/>
</properties>
</component>
<component id="8680b" class="javax.swing.JTextField" binding="modPath" default-binding="true">
......@@ -84,7 +84,7 @@
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Mod JAR:"/>
<text resource-bundle="tanslations" key="modJar"/>
</properties>
</component>
<component id="efae" class="javax.swing.JButton" binding="browseButton" default-binding="true">
......@@ -92,7 +92,7 @@
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Browse"/>
<text resource-bundle="tanslations" key="browse"/>
</properties>
</component>
</children>
......
......@@ -13,6 +13,7 @@ import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.util.ResourceBundle;
public class AddModDialog extends JDialog {
private JPanel contentPane;
......@@ -102,10 +103,10 @@ public class AddModDialog extends JDialog {
panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false));
panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
buttonOK = new JButton();
buttonOK.setText("OK");
this.$$$loadButtonText$$$(buttonOK, ResourceBundle.getBundle("tanslations").getString("ok"));
panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
buttonCancel = new JButton();
buttonCancel.setText("Cancel");
this.$$$loadButtonText$$$(buttonCancel, ResourceBundle.getBundle("tanslations").getString("cancel"));
panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));
......@@ -114,18 +115,72 @@ public class AddModDialog extends JDialog {
panel3.add(spacer2, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final JLabel label1 = new JLabel();
label1.setFont(new Font(label1.getFont().getName(), label1.getFont().getStyle(), 48));
label1.setText("Add Mod");
this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("tanslations").getString("addMod"));
panel3.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
modPath = new JTextField();
panel3.add(modPath, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JLabel label2 = new JLabel();
label2.setText("Mod JAR:");
this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("tanslations").getString("modJar"));
panel3.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
browseButton = new JButton();
browseButton.setText("Browse");
this.$$$loadButtonText$$$(browseButton, ResourceBundle.getBundle("tanslations").getString("browse"));
panel3.add(browseButton, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
/**
* @noinspection ALL
*/
private void $$$loadLabelText$$$(JLabel component, String text) {
StringBuffer result = new StringBuffer();
boolean haveMnemonic = false;
char mnemonic = '\0';
int mnemonicIndex = -1;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '&') {
i++;
if (i == text.length()) break;
if (!haveMnemonic && text.charAt(i) != '&') {
haveMnemonic = true;
mnemonic = text.charAt(i);
mnemonicIndex = result.length();
}
}
result.append(text.charAt(i));
}
component.setText(result.toString());
if (haveMnemonic) {
component.setDisplayedMnemonic(mnemonic);
component.setDisplayedMnemonicIndex(mnemonicIndex);
}
}
/**
* @noinspection ALL
*/
private void $$$loadButtonText$$$(AbstractButton component, String text) {
StringBuffer result = new StringBuffer();
boolean haveMnemonic = false;
char mnemonic = '\0';
int mnemonicIndex = -1;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '&') {
i++;
if (i == text.length()) break;
if (!haveMnemonic && text.charAt(i) != '&') {
haveMnemonic = true;
mnemonic = text.charAt(i);
mnemonicIndex = result.length();
}
}
result.append(text.charAt(i));
}
component.setText(result.toString());
if (haveMnemonic) {
component.setMnemonic(mnemonic);
component.setDisplayedMnemonicIndex(mnemonicIndex);
}
}
/**
* @noinspection ALL
*/
......
......@@ -3,7 +3,7 @@
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="550" height="400"/>
<xy x="20" y="20" width="566" height="400"/>
</constraints>
<properties/>
<border type="none"/>
......@@ -22,7 +22,7 @@
</constraints>
<properties>
<font size="48" style="0"/>
<text value="Configure mods"/>
<text resource-bundle="tanslations" key="configure_mods"/>
</properties>
</component>
<component id="9440f" class="javax.swing.JButton" binding="okButton" default-binding="true">
......@@ -30,7 +30,7 @@
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Ok"/>
<text resource-bundle="tanslations" key="ok"/>
</properties>
</component>
<component id="fddf6" class="javax.swing.JButton" binding="cancelButton" default-binding="true">
......@@ -38,7 +38,7 @@
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Cancel"/>
<text resource-bundle="tanslations" key="cancel"/>
</properties>
</component>
<grid id="87f08" binding="buttonList" layout-manager="GridBagLayout">
......@@ -54,7 +54,7 @@
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Add"/>
<text resource-bundle="tanslations" key="add"/>
</properties>
</component>
<component id="92394" class="javax.swing.JButton" binding="removeButton" default-binding="true">
......@@ -63,7 +63,7 @@
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Remove"/>
<text resource-bundle="tanslations" key="remove"/>
</properties>
</component>
</children>
......
......@@ -7,10 +7,10 @@ import net.ccbluex.LiquidLauncher.launch.mods.Mod;
import net.ccbluex.LiquidLauncher.launch.mods.ModsTableModel;
import javax.swing.*;
import javax.swing.table.TableColumn;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;
/**
* Copyright © 2015 - 2017 | CCBlueX | All rights reserved.
......@@ -64,7 +64,8 @@ public class ConfigureModsForm extends JDialog {
dialog.setVisible(true);
});
removeButton.addActionListener(e -> {
modsTable.removeColumn(new TableColumn(modsTable.getSelectedColumn()));
model.mods.remove(modsTable.getSelectedColumn());
modsTable.updateUI();
});
cancelButton.addActionListener(e -> dispose());
okButton.addActionListener(e -> {
......@@ -92,19 +93,19 @@ public class ConfigureModsForm extends JDialog {
panel1.add(modsTable, new GridConstraints(1, 0, 2, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false));
final JLabel label1 = new JLabel();
label1.setFont(new Font(label1.getFont().getName(), Font.PLAIN, 48));
label1.setText("Configure mods");
this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("tanslations").getString("configure_mods"));
panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
okButton = new JButton();
okButton.setText("Ok");
this.$$$loadButtonText$$$(okButton, ResourceBundle.getBundle("tanslations").getString("ok"));
panel1.add(okButton, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cancelButton = new JButton();
cancelButton.setText("Cancel");
this.$$$loadButtonText$$$(cancelButton, ResourceBundle.getBundle("tanslations").getString("cancel"));
panel1.add(cancelButton, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
buttonList = new JPanel();
buttonList.setLayout(new GridBagLayout());
panel1.add(buttonList, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
addButton = new JButton();
addButton.setText("Add");
this.$$$loadButtonText$$$(addButton, ResourceBundle.getBundle("tanslations").getString("add"));
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 0;
......@@ -112,7 +113,7 @@ public class ConfigureModsForm extends JDialog {
gbc.fill = GridBagConstraints.HORIZONTAL;
buttonList.add(addButton, gbc);
removeButton = new JButton();
removeButton.setText("Remove");
this.$$$loadButtonText$$$(removeButton, ResourceBundle.getBundle("tanslations").getString("remove"));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
......@@ -120,6 +121,60 @@ public class ConfigureModsForm extends JDialog {
buttonList.add(removeButton, gbc);
}
/**
* @noinspection ALL
*/
private void $$$loadLabelText$$$(JLabel component, String text) {
StringBuffer result = new StringBuffer();
boolean haveMnemonic = false;
char mnemonic = '\0';
int mnemonicIndex = -1;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '&') {
i++;
if (i == text.length()) break;
if (!haveMnemonic && text.charAt(i) != '&') {
haveMnemonic = true;
mnemonic = text.charAt(i);
mnemonicIndex = result.length();
}
}
result.append(text.charAt(i));
}
component.setText(result.toString());
if (haveMnemonic) {
component.setDisplayedMnemonic(mnemonic);
component.setDisplayedMnemonicIndex(mnemonicIndex);
}
}
/**
* @noinspection ALL