123456789101112131415161718192021222324252627 |
- package ui.view;
- import javax.swing.JTextArea;
- import javax.swing.text.DefaultCaret;
- /**
- * Little new swing object to print data to a console.
- * @author tom
- *
- */
- public class Console extends JTextArea {
- public Console() {
- super();
- this.setEditable(false);
- DefaultCaret caret = (DefaultCaret)this.getCaret();
- caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
- }
- public void clear() {
- this.setText("");
- }
- public void print(String message) {
- this.append(message);
- }
- public void println(String message) {
- this.append(message + "\n");
- }
- }
|