gov.nist.antd.java.swing
Class OutPutScreen

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--gov.nist.antd.java.swing.OutPutScreen
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class OutPutScreen
extends javax.swing.JPanel

This Class contains a component that receives the redirected error- and standard outputstream.

 This class was developed at the National Institute of Standards and
 Technology by employees of the Federal Government in the course of
 their official duties. Pursuant to title 17 Section 105 of the United
 States Code this software is not subject to copyright protection and
 is in the public domain.
 NIST assumes no responsibility whatsoever for its use by other parties,
 and makes no guarantees, expressed or implied, about its quality,
 reliability, or any other characteristic.
 
We would appreciate acknowledgement if the software is used.
NIST ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.

Author:
borchert
See Also:
Serialized Form

Nested Class Summary
static class OutPutScreen.Redirector
          This class redirects all outputs to registered OutPutScreen's.
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  boolean enablePopUp
          Indicates if the popup menu is activated or not.
private  boolean err
          Indicates if the component redirects the standard error stream.
private static java.io.PrintStream errStream
          The new err PrintStream that redirects all print/println calls to the registered receivers.
private static java.util.Vector errVector
          The Vector contains all OutPutScreen's that registered for receiving the System.err calls.
private  javax.swing.JMenuItem mnuClear
           
private  javax.swing.JPopupMenu mnuPopUp
           
private  boolean out
          Indicates if the component redirects the standard output stream.
private  javax.swing.JEditorPane output
           
private  javax.swing.JScrollPane outputPane
           
private static java.io.PrintStream outStream
          The new out PrintStream that redirects all print/println calls to the registered receivers.
private static java.util.Vector outVector
          The Vector contains all OutPutScreen's that registered for receiving the System.out calls.
private static java.io.PrintStream stdErrStream
          The standard System.out PrintStream.
private static java.io.PrintStream stdOutStream
          The standard System.out PrintStream.
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OutPutScreen()
          Creates new customizer OutPutEditor
 
Method Summary
 void clear()
          Clears the output screen.
static void connectAll()
          Connect all output PrintStreams with the Redirector.
static void connectErrStream()
          Connect the standard error output to the Redirector for standard error outputs.
static void connectOutStream()
          Connect the standard output to the Redirector for standard outputs.
static void disconnectAll()
          Connect all output PrintStreams with the systems default PrintStreams.
static void disconnectErrStream()
          Connect the systems default error output to the standard error output.
static void disconnectOutStream()
          Connect the systems default output to the standard output.
static java.io.PrintStream getStdErr()
          Determines the systems default error PrintStream.
static java.io.PrintStream getStdOut()
          Determines the systems default output PrintStream.
private  void initComponents()
          This method is called from within the constructor to initialize the form.
 boolean isAutoScrolls()
          Getter for property autoScrolls.
 boolean isEditable()
          Determines the edit mode of the output screen.
 boolean isEnablePopUp()
          Determine if the popup menu is activated.
 boolean isErr()
          Getter for property err.
 boolean isOut()
          Getter for property out.
private  void mnuClearActionPerformed(java.awt.event.ActionEvent evt)
          Clears the text field.
private  void outputMouseMoved(java.awt.event.MouseEvent evt)
           
private  void outputMousePressed(java.awt.event.MouseEvent evt)
          Opens the popup menu by right mouseclick.
 void setAutoScrolls(boolean autoScrolls)
          Setter for property autoScrolls.
 void setEditable(boolean newValue)
          Set the edit mode of the output screen.
 void setEnablePopUp(boolean enablePopUp)
          Enables or disables the popup menu.
 void setErr(boolean err)
          Setter for property err.
 void setOut(boolean out)
          Setter for property out.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

outVector

private static final java.util.Vector outVector
The Vector contains all OutPutScreen's that registered for receiving the System.out calls.


errVector

private static final java.util.Vector errVector
The Vector contains all OutPutScreen's that registered for receiving the System.err calls.


stdOutStream

private static final java.io.PrintStream stdOutStream
The standard System.out PrintStream.


stdErrStream

private static final java.io.PrintStream stdErrStream
The standard System.out PrintStream.


outStream

private static final java.io.PrintStream outStream
The new out PrintStream that redirects all print/println calls to the registered receivers.


errStream

private static final java.io.PrintStream errStream
The new err PrintStream that redirects all print/println calls to the registered receivers.


mnuPopUp

private javax.swing.JPopupMenu mnuPopUp

mnuClear

private javax.swing.JMenuItem mnuClear

outputPane

private javax.swing.JScrollPane outputPane

output

private javax.swing.JEditorPane output

out

private boolean out
Indicates if the component redirects the standard output stream.


err

private boolean err
Indicates if the component redirects the standard error stream.


enablePopUp

private boolean enablePopUp
Indicates if the popup menu is activated or not.

Constructor Detail

OutPutScreen

public OutPutScreen()
Creates new customizer OutPutEditor

Method Detail

getStdOut

public static final java.io.PrintStream getStdOut()
Determines the systems default output PrintStream.

Returns:
The default standard output PrintStream.

getStdErr

public static final java.io.PrintStream getStdErr()
Determines the systems default error PrintStream.

Returns:
The default standard error PrintStream.

connectOutStream

public static final void connectOutStream()
Connect the standard output to the Redirector for standard outputs.


connectErrStream

public static final void connectErrStream()
Connect the standard error output to the Redirector for standard error outputs.


disconnectErrStream

public static final void disconnectErrStream()
Connect the systems default error output to the standard error output.


disconnectOutStream

public static final void disconnectOutStream()
Connect the systems default output to the standard output.


connectAll

public static final void connectAll()
Connect all output PrintStreams with the Redirector.


disconnectAll

public static final void disconnectAll()
Connect all output PrintStreams with the systems default PrintStreams.


initComponents

private void initComponents()
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the FormEditor.


outputMouseMoved

private void outputMouseMoved(java.awt.event.MouseEvent evt)

outputMousePressed

private void outputMousePressed(java.awt.event.MouseEvent evt)
Opens the popup menu by right mouseclick.

Parameters:
evt - The mouse event.

mnuClearActionPerformed

private void mnuClearActionPerformed(java.awt.event.ActionEvent evt)
Clears the text field.

Parameters:
evt - The calling event.

isOut

public boolean isOut()
Getter for property out.

Returns:
Value of property out.

setOut

public void setOut(boolean out)
Setter for property out.

Parameters:
out - New value of property out.

isErr

public boolean isErr()
Getter for property err.

Returns:
Value of property err.

setErr

public void setErr(boolean err)
Setter for property err.

Parameters:
err - New value of property err.

clear

public void clear()
Clears the output screen.


isAutoScrolls

public boolean isAutoScrolls()
Getter for property autoScrolls.

Returns:
Value of property autoScrolls.

setAutoScrolls

public void setAutoScrolls(boolean autoScrolls)
Setter for property autoScrolls.

Parameters:
autoScrolls - New value of property autoScrolls.

isEnablePopUp

public boolean isEnablePopUp()
Determine if the popup menu is activated.

Returns:
Value of property enablePopUp.

setEnablePopUp

public void setEnablePopUp(boolean enablePopUp)
Enables or disables the popup menu.

Parameters:
enablePopUp - New value of property enablePopUp.

isEditable

public boolean isEditable()
Determines the edit mode of the output screen.

Returns:
If true the output is in read/write; otherwise read only mode.

setEditable

public void setEditable(boolean newValue)
Set the edit mode of the output screen.

Parameters:
newValue - If true the output is in read/write; otherwise read only mode.