Inheritance diagram for OutputStreamArea::
Public Methods | |
OutputStreamArea (int rows, int columns) | |
Constructor. More... | |
OutputStreamArea (int rows, int columns, boolean capture) | |
Constructor. More... | |
void | capture () |
capture redirects all the output to the TextArea. More... | |
void | actionPerformed (ActionEvent e) |
Implementation of ActionListener. More... | |
Static Public Methods | |
void | print (String str) |
Displays the given string (without printing a newline). More... | |
void | println (String str) |
Displays the given string and a newline. More... | |
void | clear () |
Clears the output area. More... | |
Protected Methods | |
native void | initGuiOutputStream () |
void | doPrint (String str) |
void | doPrintln (String str) |
void | doClear () |
|
00028 { 00029 this(rows, columns, true); 00030 } |
|
00035 { 00036 if(capture) _theOutput = this; 00037 00038 setLayout(new GridBagLayout()); 00039 00040 JLabel label = new JLabel("OutputStream Area"); 00041 addGridComp(this, label, 0, 0, 1, 1, 00042 GridBagConstraints.NONE, 0.0, 0.0, 1, 1); 00043 00044 _bClear = new JButton("Clear"); 00045 _bClear.addActionListener(this); 00046 addGridComp(this, _bClear, 1, 0, 1, 1, 00047 GridBagConstraints.NONE, 0.0, 0.0, 1, 1); 00048 00049 _text = new JTextArea(rows, columns); 00050 _text.setEditable(false); 00051 JScrollPane scrollPane = new JScrollPane(_text, 00052 JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 00053 JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); 00054 addGridComp(this, scrollPane, 0, 1, 10, 1, 00055 GridBagConstraints.BOTH, 1.0, 1.0, 1, 1); 00056 00057 //initGuiOutputStream(); 00058 } |
|
capture redirects all the output to the TextArea. This method is helpful when an OutputStreamArea is created and you wait till the containing frame is shown to redirect the output (in the meantime all the output goes to the console).
00065 { 00066 _theOutput = this; 00067 } |
|
Implementation of ActionListener.
00072 { 00073 if (e.getSource() == _bClear) 00074 doClear(); 00075 } |
|
Displays the given string (without printing a newline).
00081 { 00082 if (_theOutput != null) 00083 _theOutput.doPrint(str); 00084 else 00085 System.out.print(str); 00086 } |
|
Displays the given string and a newline.
00092 { 00093 if (_theOutput != null) 00094 _theOutput.doPrintln(str); 00095 else 00096 System.out.println(str); 00097 } |
|
Clears the output area.
00103 { 00104 if (_theOutput != null) 00105 _theOutput.doClear(); 00106 } |
|
Reimplemented in AppletOutputStreamArea. |
|
00112 { 00113 _text.append(str); 00114 } |
|
00117 { 00118 _text.append(str + "\n"); 00119 } |
|
Reimplemented in AppletOutputStreamArea.
00122 { 00123 _text.setText(""); 00124 } |