Horus Doc || Java GUI Reference || Doxygen's quick Index  

OutputStreamArea Class Reference

An area for textual output. More...

Inheritance diagram for OutputStreamArea::

AppletOutputStreamArea List of all members.

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 ()

Detailed Description

An area for textual output.


Constructor & Destructor Documentation

OutputStreamArea::OutputStreamArea int    rows,
int    columns
[inline]
 

Constructor.

00028 {
00029     this(rows, columns, true);
00030 }

OutputStreamArea::OutputStreamArea int    rows,
int    columns,
boolean    capture
[inline]
 

Constructor.

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 }


Member Function Documentation

void OutputStreamArea::capture   [inline]
 

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 }

void OutputStreamArea::actionPerformed ActionEvent    e [inline]
 

Implementation of ActionListener.

00072 {
00073     if (e.getSource() == _bClear)
00074         doClear();
00075 }

void OutputStreamArea::print String    str [inline, static]
 

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 }

void OutputStreamArea::println String    str [inline, static]
 

Displays the given string and a newline.

00092 {
00093     if (_theOutput != null)
00094         _theOutput.doPrintln(str);
00095     else
00096         System.out.println(str);
00097 }

void OutputStreamArea::clear   [inline, static]
 

Clears the output area.

00103 {
00104     if (_theOutput != null)
00105         _theOutput.doClear();
00106 }

native void OutputStreamArea::initGuiOutputStream   [protected]
 

Reimplemented in AppletOutputStreamArea.

void OutputStreamArea::doPrint String    str [inline, protected]
 

00112 {
00113     _text.append(str);
00114 }

void OutputStreamArea::doPrintln String    str [inline, protected]
 

00117 {
00118     _text.append(str + "\n");
00119 }

void OutputStreamArea::doClear   [inline, protected]
 

Reimplemented in AppletOutputStreamArea.

00122 {
00123     _text.setText("");
00124 }


The documentation for this class was generated from the following file:
Generated on Tue Feb 3 14:19:49 2004 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001