Cleanup
This commit is contained in:
@ -20,7 +20,7 @@ import java.util.Scanner;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Generates a GUI
|
||||
* Generates a GUI.
|
||||
*
|
||||
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
||||
* @version 0.0.0.1
|
||||
@ -60,7 +60,7 @@ public class GUI implements ActionListener {
|
||||
//TODO: Update target server list with the list of servers when adding or removing a server.
|
||||
|
||||
/**
|
||||
* Create the application.
|
||||
* Create the application window.
|
||||
*/
|
||||
public GUI() {
|
||||
initialize();
|
||||
@ -68,10 +68,6 @@ public class GUI implements ActionListener {
|
||||
gui = this;
|
||||
}
|
||||
|
||||
public JFrame getFrame() {
|
||||
return this.frame;
|
||||
}
|
||||
|
||||
public void setStatus(String text) {
|
||||
this.lblStatuslabel.setText(text);
|
||||
}
|
||||
@ -92,8 +88,9 @@ public class GUI implements ActionListener {
|
||||
Object selected = profiles.getSelectedItem();
|
||||
if (selected != null) {
|
||||
return Profile.getProfile(selected.toString());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static GUI getGUI() {
|
||||
@ -118,9 +115,6 @@ public class GUI implements ActionListener {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the contents of the frame.
|
||||
*/
|
||||
private void initialize() {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
@ -481,10 +475,11 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads all combo boxes, updates variables and saves to disk
|
||||
* Reads all combo boxes, updates variables (and saves to disk).
|
||||
*/
|
||||
private void save() {
|
||||
currentProfile().save();
|
||||
//TODO: Save to a text file.
|
||||
}
|
||||
|
||||
/**
|
||||
@ -518,7 +513,7 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the runInBackground setting to the current profile
|
||||
* Saves the runInBackground setting to the current profile.
|
||||
*/
|
||||
private void background() {
|
||||
Object selected = profiles.getSelectedItem();
|
||||
@ -536,7 +531,7 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the downloadJars setting to the current profile
|
||||
* Saves the downloadJars setting to the current profile.
|
||||
*/
|
||||
private void downloadJars() {
|
||||
Object selected = profiles.getSelectedItem();
|
||||
@ -549,7 +544,7 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies all server directories to a folder specified by the user
|
||||
* Copies all server directories to a folder specified by the user.
|
||||
*/
|
||||
private void backup() {
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
@ -583,7 +578,7 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an url in the user's default application
|
||||
* Opens an url in the user's default application.
|
||||
*
|
||||
* @param url URL to open
|
||||
*/
|
||||
@ -597,32 +592,34 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads popup messages from a text file
|
||||
* Loads popup messages from a text file.
|
||||
*/
|
||||
private void loadMessages() {
|
||||
try (Scanner in = new Scanner(new File("config/menumsg.csv"))) {
|
||||
while (in.hasNextLine()) {
|
||||
String[] line = in.nextLine().split("=");
|
||||
String content = line[1].replaceAll("_BREAK_",System.getProperty("line.separator"));
|
||||
switch (line[0]) {
|
||||
case "setup":
|
||||
setupText = content;
|
||||
break;
|
||||
case "runinbk":
|
||||
runInBackgroundText = content;
|
||||
break;
|
||||
case "delaystartup":
|
||||
delayStartupText = content;
|
||||
break;
|
||||
case "downloadjars":
|
||||
downloadJarsText = content;
|
||||
break;
|
||||
case "about":
|
||||
aboutText = content;
|
||||
}
|
||||
}
|
||||
Scanner file;
|
||||
try {
|
||||
file = new Scanner(new File("config/menumsg.csv"));
|
||||
} catch (FileNotFoundException e) {
|
||||
JOptionPane.showMessageDialog(null, "Messages file could not be read", "Setup", JOptionPane.ERROR_MESSAGE);
|
||||
file = new Scanner(GUI.class.getResourceAsStream("/config/menumsg.csv"));
|
||||
}
|
||||
while (file.hasNextLine()) {
|
||||
String[] line = file.nextLine().split("=");
|
||||
String content = line[1].replaceAll("_BREAK_", System.getProperty("line.separator"));
|
||||
switch (line[0]) {
|
||||
case "setup":
|
||||
setupText = content;
|
||||
break;
|
||||
case "runinbk":
|
||||
runInBackgroundText = content;
|
||||
break;
|
||||
case "delaystartup":
|
||||
delayStartupText = content;
|
||||
break;
|
||||
case "downloadjars":
|
||||
downloadJarsText = content;
|
||||
break;
|
||||
case "about":
|
||||
aboutText = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,9 @@ import javax.swing.JTabbedPane;
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
/**
|
||||
* A parent window for server consoles
|
||||
* Should be toggled with the "View server consoles" button
|
||||
* Keeps track of all consoles
|
||||
* A parent window for server consoles.
|
||||
* Should be toggled with the "View server consoles" button.
|
||||
* Keeps track of all consoles.
|
||||
*
|
||||
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
||||
* @version 0.0.0.1
|
||||
|
@ -8,8 +8,8 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* Contains all buttons for configuring a server
|
||||
* Does some visual stuff by itself, but otherwise reads boxes and stuff
|
||||
* Contains all buttons for configuring a server.
|
||||
* Does some visual stuff by itself, but otherwise reads user inputs.
|
||||
*
|
||||
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
||||
* @version 0.0.0.1
|
||||
|
Reference in New Issue
Block a user