Skip to content

Commit 2022ff3

Browse files
committed
Changed update dialog
1 parent e6d20ff commit 2022ff3

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

src/main/java/org/mcphackers/mcp/main/MainGUI.java

+23-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.mcphackers.mcp.main;
22

3+
import java.awt.BorderLayout;
34
import java.awt.Font;
45
import java.nio.file.Path;
56
import java.nio.file.Paths;
@@ -9,7 +10,9 @@
910
import javax.swing.JLabel;
1011
import javax.swing.JOptionPane;
1112
import javax.swing.JPanel;
13+
import javax.swing.SwingConstants;
1214
import javax.swing.SwingUtilities;
15+
import javax.swing.border.EmptyBorder;
1316
import javax.tools.JavaCompiler;
1417
import javax.tools.ToolProvider;
1518

@@ -130,29 +133,42 @@ public Path getWorkingDir() {
130133

131134
@Override
132135
public boolean updateDialogue(String changelog, String version) {
136+
JPanel outer = new JPanel(new BorderLayout());
133137
JPanel components = new JPanel();
134138
components.setLayout(new BoxLayout(components, BoxLayout.Y_AXIS));
135139
String[] lines = changelog.split("\n");
136140
for(String line : lines) {
137141
line = line.replace("`", "");
142+
String bullet = "•";
138143
if(line.startsWith("# ")) {
139144
JLabel label = new JLabel(line.substring(2));
140-
Font font = label.getFont();
141-
font.deriveFont(3F);
142-
label.setFont(new Font(font.getName(), Font.PLAIN, 18));
145+
label.setBorder(new EmptyBorder(0, 0, 4, 0));
146+
label.setFont(label.getFont().deriveFont(22F));
143147
components.add(label);
144148
}
145149
else if(line.startsWith("-"))
146150
{
147-
String bullet = "•";
148-
JLabel label = new JLabel(bullet + line.substring(1));
151+
JLabel label = new JLabel(bullet + " " + line.substring(1));
152+
label.setFont(label.getFont().deriveFont(Font.PLAIN).deriveFont(14F));
153+
components.add(label);
154+
}
155+
else if(line.startsWith(" -"))
156+
{
157+
JLabel label = new JLabel(bullet + " " + line.substring(3));
158+
label.setFont(label.getFont().deriveFont(Font.PLAIN).deriveFont(14F));
159+
label.setBorder(new EmptyBorder(0, 12, 0, 0));
149160
components.add(label);
150161
}
151162
else {
152163
components.add(new JLabel(line));
153164
}
154165
}
155-
components.add(new JLabel("Are you sure you want to update?"));
156-
return JOptionPane.showConfirmDialog(frame, components, "New version found: " + version, JOptionPane.YES_NO_OPTION) == 0;
166+
outer.add(components);
167+
JLabel label = new JLabel("Are you sure you want to update?");
168+
label.setFont(label.getFont().deriveFont(14F));
169+
label.setBorder(new EmptyBorder(10, 0, 0, 0));
170+
label.setHorizontalAlignment(SwingConstants.CENTER);
171+
outer.add(label, BorderLayout.SOUTH);
172+
return JOptionPane.showConfirmDialog(frame, outer, "New version found: " + version, JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE) == 0;
157173
}
158174
}

0 commit comments

Comments
 (0)