|
1 | 1 | package org.mcphackers.mcp.main; |
2 | 2 |
|
| 3 | +import java.awt.BorderLayout; |
3 | 4 | import java.awt.Font; |
4 | 5 | import java.nio.file.Path; |
5 | 6 | import java.nio.file.Paths; |
|
9 | 10 | import javax.swing.JLabel; |
10 | 11 | import javax.swing.JOptionPane; |
11 | 12 | import javax.swing.JPanel; |
| 13 | +import javax.swing.SwingConstants; |
12 | 14 | import javax.swing.SwingUtilities; |
| 15 | +import javax.swing.border.EmptyBorder; |
13 | 16 | import javax.tools.JavaCompiler; |
14 | 17 | import javax.tools.ToolProvider; |
15 | 18 |
|
@@ -130,29 +133,42 @@ public Path getWorkingDir() { |
130 | 133 |
|
131 | 134 | @Override |
132 | 135 | public boolean updateDialogue(String changelog, String version) { |
| 136 | + JPanel outer = new JPanel(new BorderLayout()); |
133 | 137 | JPanel components = new JPanel(); |
134 | 138 | components.setLayout(new BoxLayout(components, BoxLayout.Y_AXIS)); |
135 | 139 | String[] lines = changelog.split("\n"); |
136 | 140 | for(String line : lines) { |
137 | 141 | line = line.replace("`", ""); |
| 142 | + String bullet = "•"; |
138 | 143 | if(line.startsWith("# ")) { |
139 | 144 | 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)); |
143 | 147 | components.add(label); |
144 | 148 | } |
145 | 149 | else if(line.startsWith("-")) |
146 | 150 | { |
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)); |
149 | 160 | components.add(label); |
150 | 161 | } |
151 | 162 | else { |
152 | 163 | components.add(new JLabel(line)); |
153 | 164 | } |
154 | 165 | } |
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; |
157 | 173 | } |
158 | 174 | } |
0 commit comments