2018-01-30 19:35:42 +01:00
|
|
|
package net.knarcraft.serverlauncher.userinterface;
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.*;
|
|
|
|
|
2018-01-30 19:46:14 +01:00
|
|
|
/**
|
|
|
|
* Acts as a single writable/readable tab
|
|
|
|
* Has a box for user input, and a textArea for server output.
|
|
|
|
*
|
|
|
|
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
|
|
|
* @version 0.0.0.1
|
|
|
|
* @since 0.0.0.1
|
|
|
|
*/
|
2018-01-30 19:35:42 +01:00
|
|
|
class Console {
|
|
|
|
private JTextField textInput;
|
|
|
|
private JTextArea textOutput;
|
|
|
|
|
|
|
|
void output(String text) {
|
|
|
|
this.textOutput.setText(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
Console(JTabbedPane tab, String name) {
|
|
|
|
JPanel panel = new JPanel();
|
|
|
|
tab.addTab(name, null, panel, null);
|
|
|
|
panel.setLayout(new BorderLayout(0, 0));
|
|
|
|
|
|
|
|
textInput = new JTextField();
|
|
|
|
panel.add(textInput, BorderLayout.SOUTH);
|
|
|
|
textInput.setColumns(10);
|
|
|
|
|
|
|
|
textOutput = new JTextArea();
|
|
|
|
JScrollPane scroll = new JScrollPane(textOutput);
|
|
|
|
panel.add(scroll, BorderLayout.CENTER);
|
|
|
|
textOutput.setEditable(false);
|
|
|
|
}
|
|
|
|
}
|