gbc.gridx = 0;
gbc.gridy++;
gbc.insets = LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
initialMemoryLabelWarning = new JLabelWithHover(WARNING_ICON, "<html>" + Utils.splitMultilinedString(Language
.INSTANCE.localize("settings.32bitmemorywarning"), 80, "<br/>") + "</html>", RESTART_BORDER);
initialMemoryLabel = new JLabelWithHover(Language.INSTANCE.localize("settings.initialmemory") + ":",
HELP_ICON, "<html>" + Utils.splitMultilinedString(Language.INSTANCE.localize("settings" + "" +
".initialmemoryhelp"), 80, "<br/>") + "</html>");
initialMemoryPanel = new JPanel();
initialMemoryPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
if (!Utils.is64Bit()) {
initialMemoryPanel.add(initialMemoryLabelWarning);
}
initialMemoryPanel.add(initialMemoryLabel);
add(initialMemoryPanel, gbc);
gbc.gridx++;
gbc.insets = FIELD_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
initialMemory = new JComboBox<String>();
initialMemory.addItem("64 MB");
initialMemory.addItem("128 MB");
initialMemory.addItem("256 MB");
for (String option : MEMORY_OPTIONS) {
initialMemory.addItem(option);
}
initialMemory.setSelectedItem(App.settings.getInitialMemory() + " MB");
initialMemory.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
int selectedRam = Integer.parseInt(((String) initialMemory.getSelectedItem()).replace(" MB", ""));
int maxRam = Integer.parseInt(((String) maximumMemory.getSelectedItem()).replace(" MB", ""));
if(selectedRam > maxRam) {
JOptionPane.showMessageDialog(App.settings.getParent(),
"<html>" + Language.INSTANCE.localizeWithReplace("settings.initialmemorytoohigh",
"<br/><br/>") + "</html>", Language.INSTANCE.localize("settings.help"),
JOptionPane.PLAIN_MESSAGE);
initialMemory.setSelectedItem("256 MB");
}
}
}
});
add(initialMemory, gbc);
// Maximum Memory Settings
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
maximumMemoryLabelWarning = new JLabelWithHover(WARNING_ICON, "<html>" + Utils.splitMultilinedString(Language
.INSTANCE.localize("settings.32bitmemorywarning"), 80, "<br/>") + "</html>", RESTART_BORDER);
maximumMemoryLabel = new JLabelWithHover(Language.INSTANCE.localize("settings.maximummemory") + ":",
HELP_ICON, "<html>" + Utils.splitMultilinedString(Language.INSTANCE.localize("settings" + "" +
".maximummemoryhelp"), 80, "<br/>") + "</html>");
maximumMemoryPanel = new JPanel();
maximumMemoryPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
if (!Utils.is64Bit()) {
maximumMemoryPanel.add(maximumMemoryLabelWarning);
}
maximumMemoryPanel.add(maximumMemoryLabel);
add(maximumMemoryPanel, gbc);
gbc.gridx++;
gbc.insets = FIELD_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
maximumMemory = new JComboBox<String>();
for (String option : MEMORY_OPTIONS) {
maximumMemory.addItem(option);
}
maximumMemory.setSelectedItem(App.settings.getMaximumMemory() + " MB");
maximumMemory.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
int selectedRam = Integer.parseInt(((String) maximumMemory.getSelectedItem()).replace(" MB", ""));
if (selectedRam > 4096) {
JOptionPane.showMessageDialog(App.settings.getParent(),
"<html>" + Language.INSTANCE.localizeWithReplace("settings.toomuchramallocated",
"<br/><br/>") + "</html>", Language.INSTANCE.localize("settings.help"),
JOptionPane.PLAIN_MESSAGE);
}
}
}
});
add(maximumMemory, gbc);
// Perm Gen Settings
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
permGenLabel = new JLabelWithHover(Language.INSTANCE.localize("settings.permgen") + ":", HELP_ICON,
Language.INSTANCE.localize("settings.permgenhelp"));
add(permGenLabel, gbc);
gbc.gridx++;
gbc.insets = FIELD_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
permGen = new JTextField(4);
permGen.setText(App.settings.getPermGen() + "");
add(permGen, gbc);
// Window Size
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 1;
gbc.insets = LABEL_INSETS_SMALL;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
windowSizeLabel = new JLabelWithHover(Language.INSTANCE.localize("settings.windowsize") + ":", HELP_ICON,
Language.INSTANCE.localize("settings.windowsizehelp"));
add(windowSizeLabel, gbc);
gbc.gridx++;
gbc.insets = FIELD_INSETS_SMALL;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
windowSizePanel = new JPanel();
windowSizePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
widthField = new JTextField(4);
widthField.setText(App.settings.getWindowWidth() + "");
heightField = new JTextField(4);
heightField.setText(App.settings.getWindowHeight() + "");
commonScreenSizes = new JComboBox<String>();
commonScreenSizes.addItem("Select An Option");
commonScreenSizes.addItem("854x480");
if (Utils.getMaximumWindowWidth() >= 1280 && Utils.getMaximumWindowHeight() >= 720) {
commonScreenSizes.addItem("1280x720");
}
if (Utils.getMaximumWindowWidth() >= 1600 && Utils.getMaximumWindowHeight() >= 900) {
commonScreenSizes.addItem("1600x900");
}
if (Utils.getMaximumWindowWidth() >= 1920 && Utils.getMaximumWindowHeight() >= 1080) {
commonScreenSizes.addItem("1920x1080");
}
commonScreenSizes.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String selected = (String) commonScreenSizes.getSelectedItem();
if (selected.contains("x")) {
String[] parts = selected.split("x");
widthField.setText(parts[0]);
heightField.setText(parts[1]);
}
}
});
commonScreenSizes.setPreferredSize(new Dimension(commonScreenSizes.getPreferredSize().width + 10,
commonScreenSizes.getPreferredSize().height));
windowSizePanel.add(widthField);
windowSizePanel.add(new JLabel("x"));
windowSizePanel.add(heightField);
windowSizePanel.add(commonScreenSizes);
add(windowSizePanel, gbc);
// Java Path
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 1;
gbc.insets = LABEL_INSETS_SMALL;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
javaPathLabel = new JLabelWithHover(Language.INSTANCE.localize("settings.javapath") + ":", HELP_ICON,
"<html>" + Language.INSTANCE.localizeWithReplace("settings.javapathhelp", "<br/>") + "</html>");
add(javaPathLabel, gbc);
gbc.gridx++;
gbc.insets = LABEL_INSETS_SMALL;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
javaPathPanel = new JPanel();
javaPathPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
javaPath = new JTextField(20);
javaPath.setText(App.settings.getJavaPath());
javaPathResetButton = new JButton(Language.INSTANCE.localize("settings.javapathreset"));
javaPathResetButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
javaPath.setText(Utils.getJavaHome());
}
});
javaPathPanel.add(javaPath);
javaPathPanel.add(javaPathResetButton);
add(javaPathPanel, gbc);
// Java Paramaters
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 1;
gbc.insets = LABEL_INSETS_SMALL;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
javaParametersLabel = new JLabelWithHover(Language.INSTANCE.localize("settings.javaparameters") + ":",
HELP_ICON, Language.INSTANCE.localize("settings.javaparametershelp"));
add(javaParametersLabel, gbc);
gbc.gridx++;
gbc.insets = LABEL_INSETS_SMALL;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
javaParametersPanel = new JPanel();
javaParametersPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
javaParameters = new JTextField(20);
javaParameters.setText(App.settings.getJavaParameters());
javaParametersResetButton = new JButton(Language.INSTANCE.localize("settings.javapathreset"));
javaParametersResetButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
javaParameters.setText("");
}
});
javaParametersPanel.add(javaParameters);
javaParametersPanel.add(javaParametersResetButton);
add(javaParametersPanel, gbc);
// Start Minecraft Maximised
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
startMinecraftMaximisedLabel = new JLabelWithHover(Language.INSTANCE.localize("settings" + "" +
".startminecraftmaximised") + "?", HELP_ICON, Language.INSTANCE.localize("settings" + "" +
".startminecraftmaximisedhelp"));
add(startMinecraftMaximisedLabel, gbc);
gbc.gridx++;
gbc.insets = FIELD_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
startMinecraftMaximised = new JCheckBox();
if (App.settings.startMinecraftMaximised()) {
startMinecraftMaximised.setSelected(true);
}
add(startMinecraftMaximised, gbc);
// Save Custom Mods
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = LABEL_INSETS;
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
saveCustomModsLabel = new JLabelWithHover(Language.INSTANCE.localize("settings.savecustommods") + "?",
HELP_ICON, Language.INSTANCE.localize("settings.savecustommodshelp"));
add(saveCustomModsLabel, gbc);
gbc.gridx++;
gbc.insets = FIELD_INSETS;