javabook
Class OutputBox

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--javabook.JavaBookDialog
                                |
                                +--javabook.OutputBox

public class OutputBox
extends JavaBookDialog

This dialog is for displaying the program output. You can save the output to a designated file by using either appendToFile or saveToFile.

This class is provided as freeware. You are free to use as provided or modify to your heart's content. But you use it at your own risk. No implied or explicit warranty is given.

See Also:
Serialized Form

Fields inherited from class javabook.JavaBookDialog
font, wasMoved
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
OutputBox()
          Default constructor.
OutputBox(java.awt.Frame owner)
          Constructs a OutputBox whose dimension owning frame is the parameter owner.
OutputBox(java.awt.Frame owner, int width, int height)
          Constructs a OutputBox whose dimension is the parameters width and height and the owning frame is the parameter owner.
OutputBox(java.awt.Frame owner, int width, int height, java.lang.String title)
          Constructs a OutputBox whose dimension is set the parameters width and height, window title is set to the parameter title, and the owning frame to the parameter owner.
OutputBox(java.awt.Frame owner, java.lang.String title)
          Constructs a OutputBox whose window title is the parameter title, and the owning frame is the parameter owner.
 
Method Summary
protected  void adjustSize()
          Adjust the size of this dialog based on the components it contains.
protected  void adjustSize(int width, int height)
          Adjust the size of this dialog based on the components it contains.
 void appendToFile(java.lang.String fileName)
          Appends the content of this dialog to filename.
 void clear()
          Implements the required method of the ActionListener.
 void print(boolean b)
          Prints out boolean b.
 void print(char ch)
          Prints out char ch.
 void print(double number)
          Prints out a real number.
 void print(long number)
          Prints out an integer number.
 void print(java.lang.String text)
          Prints out text.
 void print(java.lang.StringBuffer strBuf)
          Prints out strBuf.
 void printLine(boolean b)
          Prints out boolean b and moves the cursor to the next line.
 void printLine(char ch)
          Prints out char ch and moves the cursor to the next line.
 void printLine(double number)
          Prints out a real number and moves the cursor to the next line.
 void printLine(long number)
          Prints out an integer number and moves the cursor to the next line.
 void printLine(java.lang.String text)
          Prints out text and moves the cursor to the next line.
 void printLine(java.lang.StringBuffer strBuf)
          Prints out strBuf and moves the cursor to the next line.
 void saveToFile(java.lang.String fileName)
          Saves the content of this dialog to fileName.
 void setFont(java.awt.Font font)
          Sets the font of this dialog to the parameter font.
 void skipLine(int numberOfLines)
          Skips the numberOfLines lines.
 void waitUntilClose()
          Changes this dialog to modal and thereby causes the program execution to pause until this dialog is closed.
 void windowClosing(java.awt.event.WindowEvent e)
          Overrides the inherited method.
 
Methods inherited from class javabook.JavaBookDialog
moveToCenter, setVisible, windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getTitle, hide, isModal, isResizable, paramString, setModal, setResizable, setTitle, show
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, finalize, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, setCursor, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OutputBox

public OutputBox()
Default constructor.

OutputBox

public OutputBox(java.awt.Frame owner,
                 int width,
                 int height,
                 java.lang.String title)
Constructs a OutputBox whose dimension is set the parameters width and height, window title is set to the parameter title, and the owning frame to the parameter owner.
Parameters:
owner - the owning Frame object
width - the width of this dialog
height - the height of this dialog
title - the window title of this dialog

OutputBox

public OutputBox(java.awt.Frame owner,
                 int width,
                 int height)
Constructs a OutputBox whose dimension is the parameters width and height and the owning frame is the parameter owner.
Parameters:
owner - the owning Frame object
width - the width of this dialog
height - the height of this dialog

OutputBox

public OutputBox(java.awt.Frame owner,
                 java.lang.String title)
Constructs a OutputBox whose window title is the parameter title, and the owning frame is the parameter owner.
Parameters:
owner - the owning Frame object
title - the window title of this dialog

OutputBox

public OutputBox(java.awt.Frame owner)
Constructs a OutputBox whose dimension owning frame is the parameter owner.
Parameters:
owner - the owning Frame object
Method Detail

appendToFile

public void appendToFile(java.lang.String fileName)
Appends the content of this dialog to filename.
Parameters:
fileName - the name of the file to save the content of this dialog

clear

public void clear()
Implements the required method of the ActionListener. Do not call this method. The Java virtual machine handles the action event processing. This method sets this dialog's state depending on whether the OK or CANCEL button is pressed.
Parameters:
e - the ActionEvent object.

print

public void print(boolean b)
Prints out boolean b.
Parameters:
b - boolean data to output

print

public void print(char ch)
Prints out char ch.
Parameters:
ch - char data to output

print

public void print(double number)
Prints out a real number.
Parameters:
number - real number value to output

print

public void print(long number)
Prints out an integer number.
Parameters:
number - integer value to output

print

public void print(java.lang.String text)
Prints out text.
Parameters:
text - String object to output

print

public void print(java.lang.StringBuffer strBuf)
Prints out strBuf.
Parameters:
strBuf - StringBuffer object to output

printLine

public void printLine(boolean b)
Prints out boolean b and moves the cursor to the next line.
Parameters:
b - boolean data to output

printLine

public void printLine(char ch)
Prints out char ch and moves the cursor to the next line.
Parameters:
ch - char data to output

printLine

public void printLine(double number)
Prints out a real number and moves the cursor to the next line.
Parameters:
number - real number value to output

printLine

public void printLine(long number)
Prints out an integer number and moves the cursor to the next line.
Parameters:
number - integer value to output

printLine

public void printLine(java.lang.String text)
Prints out text and moves the cursor to the next line.
Parameters:
text - String object to output

printLine

public void printLine(java.lang.StringBuffer strBuf)
Prints out strBuf and moves the cursor to the next line.
Parameters:
strBuf - StringBuffer object to output

saveToFile

public void saveToFile(java.lang.String fileName)
Saves the content of this dialog to fileName. If the designated file already contains data, they will be erased.
Parameters:
fileName - the name of file to save the content of this dialog.

setFont

public void setFont(java.awt.Font font)
Sets the font of this dialog to the parameter font.
Overrides:
setFont in class java.awt.Container
Parameters:
font - the new font to use for subsequent output

skipLine

public void skipLine(int numberOfLines)
Skips the numberOfLines lines.
Parameters:
numberOfLines - the number of lines to skip

waitUntilClose

public void waitUntilClose()
Changes this dialog to modal and thereby causes the program execution to pause until this dialog is closed.

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Overrides the inherited method. Sets the state of this dialog to CANCEL. The Java virtual machine handles the window event processing.
Overrides:
windowClosing in class JavaBookDialog
Parameters:
e - the WindowEvent object.

adjustSize

protected void adjustSize(int width,
                          int height)
Adjust the size of this dialog based on the components it contains.
Parameters:
width - the width of this dialog
height - the height of this dialog

adjustSize

protected void adjustSize()
Adjust the size of this dialog based on the components it contains.
Overrides:
adjustSize in class JavaBookDialog