Skip to content

Commit ac1377c

Browse files
committed
Fix bug with DecompilerSettings dialog height
1 parent 48c62ac commit ac1377c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/main/java/the/bytecode/club/jda/settings/DecompilerSettings.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
public class DecompilerSettings {
1212
private final Decompiler decompiler;
1313

14-
private final JScrollPane dialog;
15-
private final JPanel dialogPane;
14+
private final JScrollPane dialogPane;
15+
private final JPanel dialog;
1616

1717
/**
1818
* Stores all of the individual settings. Should not be modified after initialization.
@@ -25,20 +25,20 @@ public class DecompilerSettings {
2525

2626
public DecompilerSettings(Decompiler decompiler) {
2727
this.decompiler = decompiler;
28-
dialogPane = new JPanel();
29-
dialogPane.setLayout(new MigLayout("gap rel 0", "grow"));
30-
dialog = new JScrollPane(dialogPane);
31-
dialog.setBorder(BorderFactory.createEmptyBorder());
32-
dialog.setPreferredSize(new Dimension(400, 375));
28+
dialog = new JPanel();
29+
dialog.setLayout(new MigLayout("gap rel 0", "grow"));
30+
dialogPane = new JScrollPane(dialog);
31+
dialogPane.setBorder(BorderFactory.createEmptyBorder());
32+
dialogPane.setPreferredSize(new Dimension(400, 375));
3333
}
3434

3535
public void displayDialog() {
36-
Dimension oldSize = dialog.getPreferredSize();
37-
if (oldSize.height > dialogPane.getPreferredSize().height)
38-
dialog.setPreferredSize(new Dimension(oldSize.width, dialogPane.getPreferredSize().height));
39-
if (oldSize.width > dialogPane.getPreferredSize().width)
40-
dialog.setPreferredSize(new Dimension(dialogPane.getPreferredSize().width + 50, oldSize.height));
41-
if (JOptionPane.showConfirmDialog(null, dialog, decompiler.getName() + " Settings", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) {
36+
Dimension oldSize = dialogPane.getPreferredSize();
37+
if (oldSize.height > dialog.getPreferredSize().height)
38+
dialogPane.setPreferredSize(new Dimension(oldSize.width, dialog.getPreferredSize().height));
39+
if (oldSize.width > dialog.getPreferredSize().width)
40+
dialogPane.setPreferredSize(new Dimension(dialog.getPreferredSize().width + 50, dialogPane.getPreferredSize().height));
41+
if (JOptionPane.showConfirmDialog(null, dialogPane, decompiler.getName() + " Settings", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) {
4242
for (Map.Entry<SettingsEntry, JCheckBox> entry : booleanSettings.entrySet()) {
4343
entry.getKey().set(entry.getValue().isSelected());
4444
}
@@ -51,7 +51,7 @@ public void displayDialog() {
5151
entry.getKey().set(entry.getValue().getValue());
5252
}
5353
}
54-
dialog.setPreferredSize(oldSize);
54+
dialogPane.setPreferredSize(oldSize);
5555
}
5656

5757
public SettingsEntry getEntry(String key) {
@@ -93,8 +93,8 @@ public void registerSetting(SettingsEntry entry) {
9393
throw new IllegalArgumentException();
9494
}
9595

96-
dialogPane.add(item, "align right");
97-
dialogPane.add(new JLabel(entry.name), "wrap");
96+
dialog.add(item, "align right");
97+
dialog.add(new JLabel(entry.name), "wrap");
9898
}
9999

100100
public void loadFrom(JsonObject rootSettings) {

0 commit comments

Comments
 (0)