diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:21 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:21 -0600 |
commit | dfe289850f068f19ba4a83ab4e7e22a7e09c13c9 (patch) | |
tree | c297348a55df66c571de4525646e0b9762427353 /tdehtml/java/org/kde/kjas/server/KJASConsole.java | |
parent | b7658a0d5eca24a9d37c6e04f88298ef02389db0 (diff) | |
download | tdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.tar.gz tdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdehtml/java/org/kde/kjas/server/KJASConsole.java')
-rw-r--r-- | tdehtml/java/org/kde/kjas/server/KJASConsole.java | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/tdehtml/java/org/kde/kjas/server/KJASConsole.java b/tdehtml/java/org/kde/kjas/server/KJASConsole.java new file mode 100644 index 000000000..51498b59b --- /dev/null +++ b/tdehtml/java/org/kde/kjas/server/KJASConsole.java @@ -0,0 +1,93 @@ +package org.kde.kjas.server; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; + +public class KJASConsole + extends Frame + implements Console +{ + private TextArea txt; + + public KJASConsole() + { + super("Konqueror Java Console"); + + txt = new TextArea(); + txt.setEditable(false); + txt.setBackground(Color.white); + txt.setForeground(Color.black); + + Panel main = new Panel(new BorderLayout()); + Panel btns = new Panel(new BorderLayout()); + + Button clear = new Button("Clear"); + Button close = new Button("Close"); + + btns.add(clear, "West"); + btns.add(close, "East"); + + main.add(txt, "Center"); + main.add(btns, "South"); + + add( main ); + + clear.addActionListener + ( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + txt.setText(""); + } + } + ); + + close.addActionListener + ( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + } + ); + + addWindowListener + ( + new WindowAdapter() { + public void windowClosing(WindowEvent e) { + setVisible(false); + } + } + ); + + setSize(500, 300); + + PrintStream st = new PrintStream( new KJASConsoleStream(this) ); + System.setOut(st); + System.setErr(st); + + System.out.println( "Java VM version: " + + System.getProperty("java.version") ); + System.out.println( "Java VM vendor: " + + System.getProperty("java.vendor") ); + } + + public void clear() { + txt.setText(""); + } + + public void append(String msg) { + if (msg == null) { + return; + } + int length = msg.length(); + synchronized(txt) { + //get the caret position, and then get the new position + int old_pos = txt.getCaretPosition(); + txt.append(msg); + txt.setCaretPosition( old_pos + length ); + } + } +} + + |