Makes all folder selection use a common method
This commit is contained in:
parent
a3de8a9f6c
commit
cc0a5a1659
@ -9,6 +9,7 @@ import javax.naming.ConfigurationException;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all buttons for configuring a server.
|
* Contains all buttons for configuring a server.
|
||||||
@ -207,13 +208,9 @@ public class ServerTab implements ActionListener {
|
|||||||
* Sets the directory input's value if successful.
|
* Sets the directory input's value if successful.
|
||||||
*/
|
*/
|
||||||
private void browse() {
|
private void browse() {
|
||||||
JFileChooser chooser = new JFileChooser();
|
File chosenFolder = Main.getController().getGUI().askForDirectory("Server folder");
|
||||||
chooser.setCurrentDirectory(new java.io.File("/"));
|
if (chosenFolder != null) {
|
||||||
chooser.setDialogTitle("Server folder");
|
directory.setText(chosenFolder.toString());
|
||||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
||||||
chooser.setAcceptAllFileFilterUsed(false);
|
|
||||||
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
|
||||||
directory.setText(chooser.getSelectedFile().toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user