2626
2727package org .geysermc .pack .converter .bootstrap ;
2828
29+ import com .formdev .flatlaf .intellijthemes .FlatArcDarkIJTheme ;
2930import com .twelvemonkeys .image .BufferedImageIcon ;
3031import org .geysermc .pack .converter .PackConverter ;
32+ import org .geysermc .pack .converter .bootstrap .components .DefaultButtonBorder ;
33+ import org .geysermc .pack .converter .bootstrap .components .HelpButton ;
34+ import org .geysermc .pack .converter .bootstrap .components .PrideButtonBorder ;
35+ import org .geysermc .pack .converter .bootstrap .components .StaticButtonBorder ;
3136import org .geysermc .pack .converter .converter .Converters ;
3237import org .geysermc .pack .converter .util .ImageUtil ;
3338import org .geysermc .pack .converter .util .ZipUtils ;
3439
3540import javax .imageio .ImageIO ;
3641import javax .swing .*;
42+ import javax .swing .border .Border ;
3743import java .awt .*;
3844import java .awt .image .BufferedImage ;
3945import java .io .IOException ;
4046import java .io .InputStream ;
4147import java .math .RoundingMode ;
48+ import java .net .URI ;
49+ import java .net .URISyntaxException ;
4250import java .nio .file .Files ;
4351import java .nio .file .Path ;
4452import java .text .DecimalFormat ;
@@ -62,12 +70,26 @@ public class ThunderGUI extends JFrame {
6270 private Path outputPath = null ;
6371 private BufferedImage currentIcon = null ;
6472
73+ public static void start (boolean debug ) throws IOException {
74+ FlatArcDarkIJTheme .setup ();
75+
76+ new ThunderGUI (debug );
77+ }
78+
6579 public ThunderGUI (boolean debug ) throws IOException {
6680 vanillaPackPath = Path .of (System .getenv ("LOCALAPPDATA" ) != null ? System .getenv ("LOCALAPPDATA" ) : System .getProperty ("user.home" ), "Thunder" , "Vanilla-Assets.zip" );
6781
6882 decimalFormat = new DecimalFormat ("#.##" );
6983 decimalFormat .setRoundingMode (RoundingMode .HALF_UP );
7084
85+ Border border ;
86+
87+ if (LocalDate .now ().getMonth ().equals (Month .JUNE )) {
88+ border = new PrideButtonBorder ();
89+ } else {
90+ border = new DefaultButtonBorder ();
91+ }
92+
7193 this .setTitle ("Thunder" );
7294 InputStream iconStream = Main .class .getResourceAsStream ("/icon.png" );
7395 if (iconStream != null ) this .setIconImage (ImageIO .read (iconStream ));
@@ -82,9 +104,26 @@ public ThunderGUI(boolean debug) throws IOException {
82104 this .add (packNameLabel );
83105
84106 JTextField packName = new JTextField ("" );
85- packName .setBounds (295 , 20 , 475 , 30 );
107+ packName .setBorder (border );
108+ packName .setEnabled (false );
109+ packName .setToolTipText ("Please select a pack first!" );
110+ packName .setBounds (295 , 20 , 425 , 30 );
86111 this .add (packName );
87112
113+ JButton helpButton = new JButton (new HelpButton ());
114+ helpButton .setToolTipText ("Open the wiki page" );
115+ helpButton .setFocusPainted (false );
116+ helpButton .setBorder (border );
117+ helpButton .setBounds (730 , 20 , 30 , 30 );
118+ helpButton .addActionListener (event -> {
119+ try {
120+ Desktop .getDesktop ().browse (new URI ("https://geysermc.org/wiki/other/thunder" ));
121+ } catch (IOException | URISyntaxException e ) {
122+ throw new RuntimeException (e );
123+ }
124+ });
125+ this .add (helpButton );
126+
88127 JLabel dataLabel = new JLabel ("Input: None | Output: None" );
89128 dataLabel .setBounds (225 , 50 , 535 , 30 );
90129 this .add (dataLabel );
@@ -94,9 +133,11 @@ public ThunderGUI(boolean debug) throws IOException {
94133 this .outputArea .setFocusable (false );
95134 this .outputArea .setLineWrap (true );
96135 this .outputArea .setTabSize (2 );
136+ this .outputArea .setBorder (BorderFactory .createEmptyBorder ());
97137
98138 JScrollPane scrollArea = new JScrollPane (this .outputArea , ScrollPaneConstants .VERTICAL_SCROLLBAR_ALWAYS , ScrollPaneConstants .HORIZONTAL_SCROLLBAR_AS_NEEDED );
99- scrollArea .setBounds (225 , 90 , 535 , 125 );
139+ scrollArea .setBounds (225 , 90 , 535 , 130 );
140+ scrollArea .setBorder (new StaticButtonBorder ());
100141
101142 this .add (scrollArea );
102143
@@ -105,15 +146,15 @@ public ThunderGUI(boolean debug) throws IOException {
105146 if (debug ) {
106147 debugCheckbox = new JCheckBox ("Debug Mode" );
107148 debugCheckbox .setBounds (650 , 225 , 105 , 25 );
108- debugCheckbox .addActionListener (event -> {
109- this .debugMode .set (debugCheckbox .isSelected ());
110- });
149+ debugCheckbox .addActionListener (event -> this .debugMode .set (debugCheckbox .isSelected ()));
111150 this .add (debugCheckbox );
112151 } else {
113152 debugCheckbox = null ;
114153 }
115154
116155 JButton convertButton = new JButton ("Convert" );
156+ convertButton .setBorder (border );
157+ convertButton .setFocusPainted (false );
117158 convertButton .setBounds (20 , 225 , debug ? 625 : 740 , 25 );
118159 convertButton .setEnabled (false );
119160 convertButton .addActionListener (event -> {
@@ -123,6 +164,7 @@ public ThunderGUI(boolean debug) throws IOException {
123164 converting .set (true );
124165 if (debugCheckbox != null ) debugCheckbox .setEnabled (false );
125166 convertButton .setEnabled (false );
167+ this .requestFocus ();
126168 this .outputArea .setText ("" );
127169 dataLabel .setText ("Converting %s..." .formatted (inputPath .getFileName ().toString ()));
128170 this .setDefaultCloseOperation (WindowConstants .DO_NOTHING_ON_CLOSE );
@@ -160,6 +202,8 @@ public ThunderGUI(boolean debug) throws IOException {
160202 this .add (convertButton );
161203
162204 JButton javaPackButton = new JButton ("Select Pack" );
205+ javaPackButton .setBorder (border );
206+ javaPackButton .setFocusPainted (false );
163207 javaPackButton .setBounds (20 , 20 , 200 , 200 );
164208 javaPackButton .addActionListener (event -> {
165209 if (converting .get ()) return ;
@@ -186,9 +230,9 @@ public ThunderGUI(boolean debug) throws IOException {
186230 );
187231 convertButton .setEnabled (true );
188232
189- if ( packName .getText (). isEmpty ()) {
190- packName .setText ( chooser . getFile (). replaceFirst ( "[.][^.]+$" , "" ) );
191- }
233+ packName .setToolTipText ( null );
234+ packName .setEnabled ( true );
235+ packName . setText ( chooser . getFile (). replaceFirst ( "[.][^.]+$" , "" ));
192236
193237 try {
194238 ZipUtils .openFileSystem (inputPath , true , path -> {
@@ -202,13 +246,10 @@ public ThunderGUI(boolean debug) throws IOException {
202246
203247 LocalDate date = LocalDate .now ();
204248
205- currentIcon = ImageUtil .borderRadias (
206- ImageUtil .resize (
207- ImageIO .read (Files .newInputStream (iconPath )),
208- 198 ,
209- 198
210- ),
211- 5
249+ currentIcon = ImageUtil .resize (
250+ ImageIO .read (Files .newInputStream (iconPath )),
251+ 198 ,
252+ 198
212253 );
213254
214255 if (date .getMonth ().equals (Month .APRIL ) && date .getDayOfMonth () == 1 ) {
0 commit comments