uk.ac.ed.ph.sciprog
Class Display

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by uk.ac.ed.ph.sciprog.Display
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class Display
extends javax.swing.JFrame

Display Panel class to implement a simple ``Input'' and ``Output'' panel for elementary Java teaching allowing the novice programmer to concentrate on the basic language syntax while still having access to reasonable window style interface. Orginal concept from Java Gently for Scientists and Engineers. AWT version by Swing version

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Display(java.lang.String title)
          Constructor to create a Display panel with a given title of default size.
Display(java.lang.String title, int xSize, int ySize)
          Constructor to create a Display panel with a given title.
 
Method Summary
 void addInput(Input in)
          Public method to add an Input to the input display field.
 void clearText()
          Method to reset the output text area.
 void paint(java.awt.Graphics g)
          Overload of print method to resize the input and output panels if the main windw has been resized.
 void print(boolean booleanValue)
          Method to print a single boolean
 void print(double doubleValue)
          Method to print a single double
 void print(int intValue)
          Method to print a single int
 void print(java.lang.String s)
          Method to print a string to the output pabel
 void printf(java.lang.String format, java.lang.Object... args)
          Method to implement the Java 5.0 printf C Style print scheme with internal formating error trap.
 void printLine(boolean b)
           
 void printLine(double d)
           
 void printLine(int i)
           
 void printLine(java.lang.String s)
           
 void println()
          Method to print newline
 void println(boolean booleanValue)
          Method to print single boolean then terminal line.
 void println(double doubleValue)
          Method to print single double then terminal line.
 void println(int intValue)
          Method to print single int then terminate line.
 void println(java.lang.String s)
          Method to print a String to the ouput panel then followed by a new line.
 void removeInput(Input in)
          Public method to remove an Input field.
 void removeInput(int index)
          Public method to remove an input field by index, being the order it which they were added, starting at zero.
 void waitForButtonPress()
          Public Waiting method, that loops until a ``go'' button is pressed.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

Display

public Display(java.lang.String title,
               int xSize,
               int ySize)
Constructor to create a Display panel with a given title. with a specified window size. This method does NOT actually render the Display Panel.

Parameters:
title - The title appearing on the NORTH box
xSize - Horizontal window size (in pixels)
ySize - vertical window size (in pixels)
See Also:
waitForButtonPress

Display

public Display(java.lang.String title)
Constructor to create a Display panel with a given title of default size. This method does NOT actually render the Display Panel.

Parameters:
title - The title appearing on the NORTH box
See Also:
waitForButtonPress
Method Detail

addInput

public void addInput(Input in)
Public method to add an Input to the input display field. They will appear in the order they are added. If this is called after the Display is rendered, then the new Input will be dynamically added at the end.

Parameters:
Input - The input object to be added.

removeInput

public void removeInput(Input in)
Public method to remove an Input field.

Parameters:
in - the Input object

removeInput

public void removeInput(int index)
Public method to remove an input field by index, being the order it which they were added, starting at zero.

Parameters:
index - the index of the Input (as in order they were added)

waitForButtonPress

public void waitForButtonPress()
Public Waiting method, that loops until a ``go'' button is pressed. It is also the trigger method to render the display.


print

public void print(java.lang.String s)
Method to print a string to the output pabel

Parameters:
s - The String to be printed.

print

public void print(int intValue)
Method to print a single int

Parameters:
intValue - The int to be printed

print

public void print(double doubleValue)
Method to print a single double

Parameters:
doubleValue - The double to be printed

print

public void print(boolean booleanValue)
Method to print a single boolean

Parameters:
booleanValue - The boolean to be printed

println

public void println()
Method to print newline


println

public void println(java.lang.String s)
Method to print a String to the ouput panel then followed by a new line.

Parameters:
s - The String to be printed.

println

public void println(int intValue)
Method to print single int then terminate line.

Parameters:
intValue - The int to be printed

println

public void println(double doubleValue)
Method to print single double then terminal line.

Parameters:
doubleValue - The double to be printed

println

public void println(boolean booleanValue)
Method to print single boolean then terminal line.

Parameters:
booleanValue - The boolean to be printed

printf

public void printf(java.lang.String format,
                   java.lang.Object... args)
Method to implement the Java 5.0 printf C Style print scheme with internal formating error trap.

Parameters:
format - The format string
args - The argument list

clearText

public void clearText()
Method to reset the output text area.


printLine

public void printLine(java.lang.String s)

printLine

public void printLine(int i)

printLine

public void printLine(double d)

printLine

public void printLine(boolean b)

paint

public void paint(java.awt.Graphics g)
Overload of print method to resize the input and output panels if the main windw has been resized.

Overrides:
paint in class java.awt.Container