diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java index 30d4054..b210f57 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java @@ -9,6 +9,7 @@ import javax.naming.ConfigurationException; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; /** * Contains all buttons for configuring a server. @@ -207,13 +208,9 @@ public class ServerTab implements ActionListener { * Sets the directory input's value if successful. */ private void browse() { - JFileChooser chooser = new JFileChooser(); - chooser.setCurrentDirectory(new java.io.File("/")); - chooser.setDialogTitle("Server folder"); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - chooser.setAcceptAllFileFilterUsed(false); - if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { - directory.setText(chooser.getSelectedFile().toString()); + File chosenFolder = Main.getController().getGUI().askForDirectory("Server folder"); + if (chosenFolder != null) { + directory.setText(chosenFolder.toString()); } }