tnt.gui
Class TnTFrame

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 tnt.gui.TnTFrame
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
Direct Known Subclasses:
TnTImp

public abstract class TnTFrame
extends javax.swing.JFrame
implements java.awt.event.ActionListener

This class instantiates the graphical component of the UI, but defines very little of its associated business logic.

Version:
1.0 - 01/2006
Author:
Steven J. Castellucci
See Also:
Serialized Form

Nested Class Summary
(package private)  class TnTFrame.InfoPanel
           
 
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
protected  javax.swing.JMenuItem aboutMenuItem
           
protected  javax.swing.JRadioButtonMenuItem blackLineMenuItem
           
protected  javax.swing.JRadioButtonMenuItem blueLineMenuItem
           
protected  javax.swing.JMenuItem calculateMenuItem
           
protected  ScrollablePaintPanel canvas
           
protected  javax.swing.JScrollPane canvasScrollPane
           
protected  javax.swing.JRadioButtonMenuItem customLineMenuItem
           
protected  javax.swing.JLabel cxValueLabel
          Displays the selected key's center x-coordinate.
protected  javax.swing.JLabel cyValueLabel
          Displays the selected key's center y-coordinate.
protected  KeyButtonListModel dataModel
          The model storing the outline keys.
protected  javax.swing.JButton deleteKeyButton
          The "Delete" button in the InfoPanel.
protected  javax.swing.JLabel dimension
           
protected  javax.swing.JButton editKeyButton
          The "Edit" button in the InfoPanel.
protected  javax.swing.JMenuItem exitMenuItem
           
protected  javax.swing.JMenuItem exportMenuItem
           
protected  javax.swing.JRadioButtonMenuItem greenLineMenuItem
           
protected  javax.swing.JLabel hValueLabel
          Displays the width of the selected key's outline.
protected  javax.swing.JRadioButtonMenuItem magentaLineMenuItem
           
protected  javax.swing.JLabel mouseLocation
           
protected  javax.swing.JMenuItem newMenuItem
           
protected  javax.swing.JMenuItem openMenuItem
           
protected  javax.swing.JMenuItem parametersMenuItem
           
protected  javax.swing.JLabel pointLocation
           
protected  javax.swing.JRadioButtonMenuItem redLineMenuItem
           
protected  javax.swing.JMenuItem redoMenuItem
           
protected  javax.swing.JMenuItem saveAsMenuItem
           
protected  javax.swing.JMenuItem saveMenuItem
           
protected  javax.swing.JList shapesList
          The list displaying the object stored in dataModel.
protected  int SPACE
          The amount of space between some components
protected  int STATUS_LABEL_WIDTH
          The width of certain labels on the status panel
protected  javax.swing.JLabel statusHelp
           
protected  javax.swing.JLabel twValueLabel
          Displays the selected key's target width.
protected  javax.swing.JMenuItem undoMenuItem
           
protected  javax.swing.JMenuItem userManualMenuItem
           
protected  int VIEWPORT_DIMENSIONS
          The size of the square viewport
protected  javax.swing.JLabel wValueLabel
          Displays the width of the selected key's outline.
protected  javax.swing.JLabel xValueLabel
          Displays the x-coordinate of the selected key's outline.
protected  javax.swing.JRadioButtonMenuItem yellowLineMenuItem
           
protected  javax.swing.JLabel yValueLabel
          Displays the y-coordinate of the selected key's outline.
 
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
TnTFrame()
           
 
Method Summary
protected abstract  void aboutAction()
          Defines action(s) to take upon selection of the "About" menu item.
 void actionPerformed(java.awt.event.ActionEvent ae)
           
protected abstract  void calculateAction()
          Defines action(s) to take upon selection of the "Calculate" menu item.
protected  javax.swing.JScrollPane createCanvasScrollPane()
          Instantiates and returns the canvas (an instance of ScrollablePaintPanel).
protected  javax.swing.JMenu createColorMenu()
          Instantiates and returns the Color menu.
protected  javax.swing.JMenu createEditMenu()
          Instantiates and returns the Edit menu.
protected  javax.swing.JMenu createFileMenu()
          Instantiates and returns the File menu.
protected  javax.swing.JMenu createHelpMenu()
          Instantiates and returns the Help menu.
protected  javax.swing.JPanel createInfoPanel()
          Instantiates components of the InfoPanel before returning an instance of InfoPanel.
protected  javax.swing.JMenu createMetricsMenu()
          Instantiates and returns the Metrics menu.
protected  javax.swing.JPanel createStatusPanel()
          Instantiates and returns the status panel.
protected abstract  void deleteKeyAction()
          Defines action(s) to take upon pressing the delete button.
protected abstract  void editKeyAction()
          Defines action(s) to take upon pressing the edit button.
protected abstract  void exitAction()
          Defines action(s) to take upon selection of the "Exit" menu item.
protected abstract  void exportAction()
          Defines action(s) to take upon selection of the "Export..." menu item.
protected abstract  boolean newAction()
          Defines action(s) to take upon selection of the "New" menu item.
protected abstract  boolean openAction()
          Defines action(s) to take upon selection of the "Open" menu item.
protected abstract  void parameterAction()
          Defines action(s) to take upon selection of the "Parameters" menu item.
protected abstract  void redoAction()
          Defines action(s) to take upon selection of the "Redo" menu item.
protected abstract  boolean saveAction()
          Defines action(s) to take upon selection of the "Save" menu item.
protected abstract  boolean saveAsAction()
          Defines action(s) to take upon selection of the "Save As" menu item.
protected abstract  void setColorAction(java.awt.Color c)
          Defines action(s) to take upon of a predefined line color.
protected abstract  void setCustomColorAction()
          Defines action(s) to take upon of a custom line color.
protected abstract  void undoAction()
          Defines action(s) to take upon selection of the "Undo" menu item.
protected abstract  void userManualAction()
          Defines action(s) to take upon selection of the "User Manual" menu item.
 
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, paint, 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
 

Field Detail

SPACE

protected final int SPACE
The amount of space between some components

See Also:
Constant Field Values

STATUS_LABEL_WIDTH

protected final int STATUS_LABEL_WIDTH
The width of certain labels on the status panel

See Also:
Constant Field Values

VIEWPORT_DIMENSIONS

protected final int VIEWPORT_DIMENSIONS
The size of the square viewport

See Also:
Constant Field Values

statusHelp

protected javax.swing.JLabel statusHelp

mouseLocation

protected javax.swing.JLabel mouseLocation

pointLocation

protected javax.swing.JLabel pointLocation

dimension

protected javax.swing.JLabel dimension

newMenuItem

protected javax.swing.JMenuItem newMenuItem

openMenuItem

protected javax.swing.JMenuItem openMenuItem

saveMenuItem

protected javax.swing.JMenuItem saveMenuItem

saveAsMenuItem

protected javax.swing.JMenuItem saveAsMenuItem

exportMenuItem

protected javax.swing.JMenuItem exportMenuItem

exitMenuItem

protected javax.swing.JMenuItem exitMenuItem

undoMenuItem

protected javax.swing.JMenuItem undoMenuItem

redoMenuItem

protected javax.swing.JMenuItem redoMenuItem

parametersMenuItem

protected javax.swing.JMenuItem parametersMenuItem

calculateMenuItem

protected javax.swing.JMenuItem calculateMenuItem

userManualMenuItem

protected javax.swing.JMenuItem userManualMenuItem

aboutMenuItem

protected javax.swing.JMenuItem aboutMenuItem

blackLineMenuItem

protected javax.swing.JRadioButtonMenuItem blackLineMenuItem

blueLineMenuItem

protected javax.swing.JRadioButtonMenuItem blueLineMenuItem

greenLineMenuItem

protected javax.swing.JRadioButtonMenuItem greenLineMenuItem

magentaLineMenuItem

protected javax.swing.JRadioButtonMenuItem magentaLineMenuItem

redLineMenuItem

protected javax.swing.JRadioButtonMenuItem redLineMenuItem

yellowLineMenuItem

protected javax.swing.JRadioButtonMenuItem yellowLineMenuItem

customLineMenuItem

protected javax.swing.JRadioButtonMenuItem customLineMenuItem

canvas

protected ScrollablePaintPanel canvas

canvasScrollPane

protected javax.swing.JScrollPane canvasScrollPane

dataModel

protected KeyButtonListModel dataModel
The model storing the outline keys. This object must be initialized before instantiating an InfoPanel object.


shapesList

protected javax.swing.JList shapesList
The list displaying the object stored in dataModel. This object must be initialized before instantiating an InfoPanel object.


cxValueLabel

protected javax.swing.JLabel cxValueLabel
Displays the selected key's center x-coordinate. This object must be initialized before instantiating an InfoPanel object.


cyValueLabel

protected javax.swing.JLabel cyValueLabel
Displays the selected key's center y-coordinate. This object must be initialized before instantiating an InfoPanel object.


twValueLabel

protected javax.swing.JLabel twValueLabel
Displays the selected key's target width. This object must be initialized before instantiating an InfoPanel object.


xValueLabel

protected javax.swing.JLabel xValueLabel
Displays the x-coordinate of the selected key's outline. This object must be initialized before instantiating an InfoPanel object.


yValueLabel

protected javax.swing.JLabel yValueLabel
Displays the y-coordinate of the selected key's outline. This object must be initialized before instantiating an InfoPanel object.


wValueLabel

protected javax.swing.JLabel wValueLabel
Displays the width of the selected key's outline. This object must be initialized before instantiating an InfoPanel object.


hValueLabel

protected javax.swing.JLabel hValueLabel
Displays the width of the selected key's outline. This object must be initialized before instantiating an InfoPanel object.


editKeyButton

protected javax.swing.JButton editKeyButton
The "Edit" button in the InfoPanel. This object must be initialized before instantiating an InfoPanel object.


deleteKeyButton

protected javax.swing.JButton deleteKeyButton
The "Delete" button in the InfoPanel. This object must be initialized before instantiating an InfoPanel object.

Constructor Detail

TnTFrame

public TnTFrame()
Method Detail

createFileMenu

protected javax.swing.JMenu createFileMenu()
Instantiates and returns the File menu.

Returns:
the configured File menu.

createEditMenu

protected javax.swing.JMenu createEditMenu()
Instantiates and returns the Edit menu.

Returns:
the configured Edit menu.

createColorMenu

protected javax.swing.JMenu createColorMenu()
Instantiates and returns the Color menu.

Returns:
the configured Color menu.

createMetricsMenu

protected javax.swing.JMenu createMetricsMenu()
Instantiates and returns the Metrics menu.

Returns:
the configured Metrics menu.

createHelpMenu

protected javax.swing.JMenu createHelpMenu()
Instantiates and returns the Help menu.

Returns:
the configured Help menu.

createStatusPanel

protected javax.swing.JPanel createStatusPanel()
Instantiates and returns the status panel.

Returns:
the configured status panel.

createInfoPanel

protected javax.swing.JPanel createInfoPanel()
Instantiates components of the InfoPanel before returning an instance of InfoPanel. The specific components that must be instantiated prior to calling the InfoPanel constructor are described as such in the API.
In addition, the delete key is mapped to the actions defined by deleteKeyAction() method.


createCanvasScrollPane

protected javax.swing.JScrollPane createCanvasScrollPane()
Instantiates and returns the canvas (an instance of ScrollablePaintPanel).


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

newAction

protected abstract boolean newAction()
Defines action(s) to take upon selection of the "New" menu item.

Returns:
true if successful, false otherwise.

openAction

protected abstract boolean openAction()
Defines action(s) to take upon selection of the "Open" menu item.

Returns:
true if successful, false otherwise.

saveAction

protected abstract boolean saveAction()
Defines action(s) to take upon selection of the "Save" menu item.

Returns:
true if successful, false otherwise.

saveAsAction

protected abstract boolean saveAsAction()
Defines action(s) to take upon selection of the "Save As" menu item.

Returns:
true if successful, false otherwise.

exportAction

protected abstract void exportAction()
Defines action(s) to take upon selection of the "Export..." menu item.


exitAction

protected abstract void exitAction()
Defines action(s) to take upon selection of the "Exit" menu item.


undoAction

protected abstract void undoAction()
Defines action(s) to take upon selection of the "Undo" menu item.


redoAction

protected abstract void redoAction()
Defines action(s) to take upon selection of the "Redo" menu item.


setColorAction

protected abstract void setColorAction(java.awt.Color c)
Defines action(s) to take upon of a predefined line color.


setCustomColorAction

protected abstract void setCustomColorAction()
Defines action(s) to take upon of a custom line color.


parameterAction

protected abstract void parameterAction()
Defines action(s) to take upon selection of the "Parameters" menu item.


calculateAction

protected abstract void calculateAction()
Defines action(s) to take upon selection of the "Calculate" menu item.


userManualAction

protected abstract void userManualAction()
Defines action(s) to take upon selection of the "User Manual" menu item.


aboutAction

protected abstract void aboutAction()
Defines action(s) to take upon selection of the "About" menu item.


editKeyAction

protected abstract void editKeyAction()
Defines action(s) to take upon pressing the edit button.


deleteKeyAction

protected abstract void deleteKeyAction()
Defines action(s) to take upon pressing the delete button.