home *** CD-ROM | disk | FTP | other *** search
- import java.awt.BorderLayout;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.Event;
- import java.awt.Panel;
- import java.awt.Rectangle;
- import java.awt.TextArea;
- import java.awt.Window;
-
- public class JDPConsoleDialog extends JDPDialog implements Runnable {
- JDPUser user;
- Container parent;
- String title;
- String message;
- String[] buttons;
- int[] icons;
- int button = -1;
- JDPButtons JDPButtons2;
- TextArea consoleOutput;
- int lastSize;
- boolean firstTime = true;
-
- public JDPConsoleDialog(JDPUser var1, Container var2) {
- super(var1, "Console Output", var2);
- this.user = var1;
- this.parent = var2;
- Panel var3 = new Panel();
- JDPChiselFramePanel var4 = new JDPChiselFramePanel(var1, "Console Output");
- this.consoleOutput = new TextArea("", 7, 60);
- this.consoleOutput.setEditable(false);
- Panel var5 = new Panel();
- String[] var6 = new String[]{"Clear", "Close"};
- int[] var7 = new int[]{JDPButton.getIconValue("Undo"), JDPButton.getIconValue("Delete")};
- this.JDPButtons2 = new JDPButtons(var1, var6, var7, JDPButtons.getAlignmentValue("Horizontal"));
- ((Container)this).add("Center", var3);
- ((Container)var3).setLayout(new BorderLayout());
- ((Container)var3).add("Center", var4);
- ((Container)var4).add("Center", this.consoleOutput);
- ((Container)var3).add("South", var5);
- ((Container)var5).setLayout(new BorderLayout());
- ((Container)var5).add("East", this.JDPButtons2);
- ((Dialog)this).setResizable(true);
- ((Dialog)this).setModal(false);
- JDesignerPro.SystemOutStream.reset();
- (new Thread(this)).start();
- }
-
- public void showAt(Rectangle var1) {
- if (!((Window)this).isShowing() || ((Component)this).bounds().x < 0 || ((Component)this).bounds().y < 0) {
- ((Component)this).reshape(var1.x, (int)((double)(var1.y + var1.height) - (double)var1.height * 0.42), var1.width, (int)((double)var1.height * 0.35));
- }
-
- ((Dialog)this).show();
- this.refresh();
- }
-
- public int refresh() {
- String var1 = "";
- int var2 = this.consoleOutput.getText().length();
-
- try {
- var1 = JDesignerPro.SystemOutStream.toString();
- if (var1.equals("")) {
- return var2;
- }
-
- JDesignerPro.SystemOutStream.reset();
- if (var1.indexOf(".usr") >= 0 || var1.indexOf("default.jot") >= 0) {
- var1 = "";
- }
-
- var1 = this.user.u.replace(var1, "BorderLayout: cannot add to layout: unknown constraint: null\r\n", "");
- var1 = this.user.u.replace(var1, "BorderLayout: cannot add to layout: unknown constraint: null", "");
- var1 = this.user.u.replace(var1, "\r", "");
- this.consoleOutput.setText(this.consoleOutput.getText() + var1);
- var2 = this.consoleOutput.getText().length();
- if (System.getProperty("java.vendor").startsWith("Microsoft") && !System.getProperty("java.version").startsWith("1.0")) {
- this.consoleOutput.setCaretPosition(var2 + 10000);
- }
-
- this.consoleOutput.select(var2 + 10000, var2 + 10000);
- } catch (Exception var3) {
- }
-
- return var2;
- }
-
- public void run() {
- while(true) {
- try {
- if (((Window)this).isShowing()) {
- Thread.sleep(1000L);
- } else {
- Thread.sleep(1000L);
- }
-
- this.refresh();
- if (this.firstTime) {
- this.firstTime = false;
- Rectangle var1 = this.user.jdpMainWindow.bounds();
- if (!((Window)this).isShowing()) {
- ((Component)this).reshape(var1.x, (int)((double)(var1.y + var1.height) - (double)var1.height * 0.42), var1.width, (int)((double)var1.height * 0.35));
- }
- }
- } catch (Exception var2) {
- }
- }
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 201:
- ((Window)this).dispose();
- return true;
- case 1001:
- if (var1.target.equals(this.JDPButtons2.button[0])) {
- JDesignerPro.SystemOutStream.reset();
- this.consoleOutput.setText("");
- this.lastSize = 0;
- }
-
- if (var1.target.equals(this.JDPButtons2.button[1])) {
- ((Window)this).dispose();
- }
-
- return true;
- default:
- return false;
- }
- }
- }
-