Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Commit ce02546

Browse files
ExplvExplv
authored andcommitted
Reduce unnecessary GUI width
1 parent 35d03ec commit ce02546

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

AIO/src/org/aio/gui/Gui.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public Gui() {
3434

3535
JPanel mainPanel = new StyledJPanel(new BorderLayout(0, 0));
3636
mainPanel.setBackground(DARK_GREY);
37-
mainPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20), null));
37+
mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 10));
3838

3939
final JLabel titleLabel = new StyledJLabel();
4040
titleLabel.setFont(new Font("Trebuchet MS", Font.BOLD, 26));
@@ -168,8 +168,7 @@ public Gui() {
168168

169169
mainPanel.add(taskList.getContainer(), BorderLayout.CENTER);
170170

171-
gui.setMinimumSize(new Dimension(700, 300));
172-
gui.setMaximumSize(new Dimension(2000, 2000));
171+
gui.setMinimumSize(new Dimension(700, 500));
173172

174173
gui.setLocationRelativeTo(null);
175174
gui.setContentPane(mainPanel);
@@ -206,13 +205,13 @@ private boolean validate(final Container container) {
206205
private JPanel createSpacerPanel() {
207206
final JPanel panel = new StyledJPanel(new BorderLayout(0, 0));
208207
panel.setBackground(DARK_GREY);
209-
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20), null));
208+
panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
210209
return panel;
211210
}
212211

213212
private JPanel createButtonPanel(final String label, final String toolTip, final String icon, final String rolloverIcon, ActionListener callback) {
214213
JPanel buttonPanel = new StyledJPanel(new BorderLayout(0, 3));
215-
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
214+
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
216215
buttonPanel.setBackground(DARK_GREY);
217216

218217
final JLabel panelLabel = new StyledJLabel();

AIO/src/org/aio/gui/task_list/TaskList.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public TaskPanel addTask(final TaskType taskType) {
8585
swapTasks(from, from + 1);
8686
});
8787

88-
((JDialog)SwingUtilities.getAncestorOfClass(JDialog.class, scrollPane)).pack();
88+
taskList.revalidate();
89+
taskList.repaint();
90+
scrollPane.repaint();
91+
scrollPane.revalidate();
8992

9093
return taskPanel;
9194
}
@@ -107,8 +110,8 @@ private void swapTasks(int from, int to) {
107110

108111
taskList.revalidate();
109112
taskList.repaint();
110-
111-
((JDialog)SwingUtilities.getAncestorOfClass(JDialog.class, scrollPane)).pack();
113+
scrollPane.repaint();
114+
scrollPane.revalidate();
112115
});
113116
}
114117

@@ -121,7 +124,8 @@ private void removeTaskPanel(final TaskPanelContent taskPanelContent) {
121124

122125
taskList.revalidate();
123126
taskList.repaint();
124-
((JDialog)SwingUtilities.getAncestorOfClass(JDialog.class, scrollPane)).pack();
127+
scrollPane.repaint();
128+
scrollPane.revalidate();
125129
}
126130

127131
/**
@@ -174,14 +178,10 @@ public void fromJSON(final JSONObject jsonObject) {
174178
addTask(TaskType.valueOf((String) taskJSON.get("type"))).fromJSON(taskJSON);
175179
}
176180

177-
taskList.validate();
181+
taskList.revalidate();
178182
taskList.repaint();
179-
180-
JDialog dialogAncestor = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, scrollPane);
181-
182-
dialogAncestor.validate();
183-
dialogAncestor.repaint();
184-
dialogAncestor.pack();
183+
scrollPane.repaint();
184+
scrollPane.revalidate();
185185
}
186186

187187
/**

AIO/src/org/aio/script/AIO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@ScriptManifest(author = "Explv", name = "Explv's AIO " + AIO.VERSION, info = "AIO", version = 0, logo = "http://i.imgur.com/58Zz0fb.png")
3131
public class AIO extends Script {
3232

33-
static final String VERSION = "v2.3.1";
33+
static final String VERSION = "v2.3.2";
3434

3535
private Gui gui;
3636
private Paint paint;

0 commit comments

Comments
 (0)