ix.iface.ui
Class JFrameMT

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 ix.iface.util.ToolFrame
                          extended by ix.iface.ui.JFrameMT
All Implemented Interfaces:
AgentNameListener, 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:
JFrameMTP

public class JFrameMT
extends ToolFrame
implements java.awt.event.ActionListener

A frame with a menu bar, a tool bar, and file/about/exit dialogues. Contains a method to create a default menu/tool bar and useful methods for building menu and tool bars. Creates an About dialog, file dialogs (open, save as), provides default functions for openFile, saveFileAs, toggleToolbar, exit, and aboutDialog.

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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 IXToolItem aboutItem
           
(package private)  CatchingActionListener catchingListener
           
 IXToolItem closeItem
           
protected  javax.swing.ImageIcon copyIcon
           
 IXToolItem copyItem
           
protected  javax.swing.ImageIcon cutIcon
           
 IXToolItem cutItem
           
 java.io.File directory
          Te directory that the application's files live in
 javax.swing.JMenu editMenu
           
 IXToolItem exitItem
           
 java.util.ArrayList extensions
          A list of file extensions to be used in the file chooser.
 java.io.File file
          The current file (for saving)
 javax.swing.JFileChooser fileChooser
           
 javax.swing.JMenu fileMenu
           
 java.lang.String fileType
          A description of the file type to be used in the file chooser.
 java.lang.String helpFile
           
 HelpFrame helpFrame
           
 javax.swing.ImageIcon helpFrameIcon
           
protected  javax.swing.ImageIcon helpIcon
           
 IXToolItem helpItem
           
 javax.swing.JMenu helpMenu
           
 javax.swing.JPanel JPanel2
           
 javax.swing.JPanel mainJPanel
           
 IXToolItem manualItem
           
 javax.swing.JMenuBar menuBar
           
protected  javax.swing.ImageIcon newIcon
           
 IXToolItem newItem
           
protected  javax.swing.ImageIcon openIcon
           
 IXToolItem openItem
           
 javax.swing.JMenu optionsMenu
           
protected  javax.swing.ImageIcon pasteIcon
           
 IXToolItem pasteItem
           
protected  javax.swing.ImageIcon redoIcon
           
 IXToolItem redoItem
           
protected  javax.swing.ImageIcon revertIcon
           
 IXToolItem revertItem
           
 IXToolItem saveAsItem
           
protected  javax.swing.ImageIcon saveIcon
           
 IXToolItem saveItem
           
(package private)  int TB_HEIGHT
           
(package private)  int TBB_HEIGHT
           
(package private)  int TBB_WIDTH
           
(package private)  int TBB_Y
           
 javax.swing.JToolBar toolBar
           
 IXToolItem toolbarItem
           
 javax.swing.JMenu toolsMenu
           
 javax.swing.JMenu viewMenu
           
 
Fields inherited from class ix.iface.util.ToolFrame
toolFrames
 
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
JFrameMT()
          Creates a frame with a menu bar, a tool bar, a main panel.
JFrameMT(java.lang.String title)
          Creates a frame (see JFrameMT()) with a given title
 
Method Summary
 void aboutDialog()
           
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void adaptDefaultMenu()
          Dummy method that can be overridden by sub-classes to adapt the default.
 void adaptDefaultMenuToolbar()
          Dummy method that can be overridden by sub-classes to adapt the default.
 void adaptDefaultToolbar()
          Dummy method that can be overridden by sub-classes to adapt the default.
 void close()
           
 void ensureFileChooser()
           
 HTMLFrame ensureHelpFrame()
           
 void exit()
           
 void exitApplication()
           
 void makeDefaultMenu()
          Makes a default menubar Menus: File (new, open, save, saveAs, Options menu, close, exit), Edit (revert, copy, cut, paste), View (), Tools(), Help (help, manual, about)
 void makeDefaultMenuToolbar()
          Makes a default menubar and toolbar.
 void MakeDefaultToolbar()
           
 void makeEditMenu()
           
 javax.swing.JMenu makeEditMenuTool(javax.swing.JComponent parentMenu)
          Makes a default edit menu and toolbar buttons.
 void makeFileMenu()
           
 void makeFileMenuExits()
           
 javax.swing.JMenu makeFileMenuTool(javax.swing.JComponent parentMenu)
          Makes a default file menu and toolbar buttons.
 void makeFileMenuToolExits(javax.swing.JMenu fileMenu)
          Makes default close/exit menu options and and toolbar buttons.
 void makeFileMenuToolFiles(javax.swing.JMenu fileMenu)
          Makes default file new/open/save/saveAs menu items and toolbar buttons.
 void makeFrame()
           
 void makeHelpMenu()
          Make sure that if this is overwritten, adaptDefaultMenu is called elsewhere.
 javax.swing.JMenu makeHelpMenuTool(javax.swing.JComponent parentMenu)
          Makes a default help menu and toolbar buttons.
 javax.swing.JMenu makeMenu(javax.swing.JComponent parent, java.lang.String label)
          Makes a menu and adds it to the given (menu) component.
 void makeMenuToolBars()
           
 void makeOptionsMenu()
           
 javax.swing.JMenu makeOptionsMenuTool(javax.swing.JComponent parentMenu)
          Makes a default options menu and toolbar buttons.
 javax.swing.JRadioButtonMenuItem makeRadioMenuItem(javax.swing.JComponent parent, java.lang.String command, java.lang.String label)
          Makes a radio button menu item and adds it to the given (menu) component.
 void makeToolbarItem(javax.swing.JMenu parentMenu)
           
 void makeToolsMenu()
           
 javax.swing.JMenu makeToolsMenuTool(javax.swing.JComponent parentMenu)
          Makes a default tools menu and toolbar buttons.
 void makeViewMenu()
           
 javax.swing.JMenu makeViewMenuTool(javax.swing.JComponent parentMenu)
          Makes a default view menu and toolbar buttons.
 void openFile()
           
 void openFile(java.io.File file)
          Overwrite this with actual opening.
 void placeToolbarButton(javax.swing.JButton button, int x)
           
 void saveFile()
           
 void saveFileAs()
           
 void saveToFile(java.io.File file)
          Overwrite this with actual saving.
 void toggleToolbar(boolean on)
           
 java.io.File userChooseFile()
           
 void userHelp()
           
 void userManual()
           
 boolean validFileName(java.lang.String name)
          Checks whether the file name has an extension listed in the frame's extensions.
 
Methods inherited from class ix.iface.util.ToolFrame
setVisible, symbolNameChanged, walkToolFrames
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, 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, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

catchingListener

CatchingActionListener catchingListener

TBB_Y

int TBB_Y

TBB_WIDTH

int TBB_WIDTH

TBB_HEIGHT

int TBB_HEIGHT

TB_HEIGHT

int TB_HEIGHT

fileChooser

public javax.swing.JFileChooser fileChooser

directory

public java.io.File directory
Te directory that the application's files live in


file

public java.io.File file
The current file (for saving)


extensions

public java.util.ArrayList extensions
A list of file extensions to be used in the file chooser. E.g. "xml"


fileType

public java.lang.String fileType
A description of the file type to be used in the file chooser. E.g. "Domain files"


helpFrame

public HelpFrame helpFrame

helpFile

public java.lang.String helpFile

helpFrameIcon

public javax.swing.ImageIcon helpFrameIcon

mainJPanel

public javax.swing.JPanel mainJPanel

JPanel2

public javax.swing.JPanel JPanel2

menuBar

public javax.swing.JMenuBar menuBar

toolBar

public javax.swing.JToolBar toolBar

fileMenu

public javax.swing.JMenu fileMenu

editMenu

public javax.swing.JMenu editMenu

viewMenu

public javax.swing.JMenu viewMenu

toolsMenu

public javax.swing.JMenu toolsMenu

helpMenu

public javax.swing.JMenu helpMenu

optionsMenu

public javax.swing.JMenu optionsMenu

newIcon

protected javax.swing.ImageIcon newIcon

openIcon

protected javax.swing.ImageIcon openIcon

saveIcon

protected javax.swing.ImageIcon saveIcon

revertIcon

protected javax.swing.ImageIcon revertIcon

redoIcon

protected javax.swing.ImageIcon redoIcon

cutIcon

protected javax.swing.ImageIcon cutIcon

copyIcon

protected javax.swing.ImageIcon copyIcon

pasteIcon

protected javax.swing.ImageIcon pasteIcon

helpIcon

protected javax.swing.ImageIcon helpIcon

newItem

public IXToolItem newItem

openItem

public IXToolItem openItem

saveItem

public IXToolItem saveItem

saveAsItem

public IXToolItem saveAsItem

toolbarItem

public IXToolItem toolbarItem

closeItem

public IXToolItem closeItem

exitItem

public IXToolItem exitItem

revertItem

public IXToolItem revertItem

redoItem

public IXToolItem redoItem

cutItem

public IXToolItem cutItem

copyItem

public IXToolItem copyItem

pasteItem

public IXToolItem pasteItem

helpItem

public IXToolItem helpItem

manualItem

public IXToolItem manualItem

aboutItem

public IXToolItem aboutItem
Constructor Detail

JFrameMT

public JFrameMT()
Creates a frame with a menu bar, a tool bar, a main panel. Also creates required dialogs (open/save file, about, exit) and handles layout.


JFrameMT

public JFrameMT(java.lang.String title)
Creates a frame (see JFrameMT()) with a given title

Parameters:
title - a string representing the frame's title
Method Detail

makeFrame

public void makeFrame()

makeMenuToolBars

public void makeMenuToolBars()

ensureFileChooser

public void ensureFileChooser()

validFileName

public boolean validFileName(java.lang.String name)
Checks whether the file name has an extension listed in the frame's extensions.

Returns:
true if the frame has no extensions listed or if the file's extension is listed in the frame's extensions. False otherwise.

makeDefaultMenu

public void makeDefaultMenu()
Makes a default menubar Menus: File (new, open, save, saveAs, Options menu, close, exit), Edit (revert, copy, cut, paste), View (), Tools(), Help (help, manual, about)


makeFileMenu

public void makeFileMenu()

makeFileMenuExits

public void makeFileMenuExits()

makeOptionsMenu

public void makeOptionsMenu()

makeToolbarItem

public void makeToolbarItem(javax.swing.JMenu parentMenu)

makeEditMenu

public void makeEditMenu()

makeViewMenu

public void makeViewMenu()

makeToolsMenu

public void makeToolsMenu()

makeHelpMenu

public void makeHelpMenu()
Make sure that if this is overwritten, adaptDefaultMenu is called elsewhere.


MakeDefaultToolbar

public void MakeDefaultToolbar()

makeDefaultMenuToolbar

public void makeDefaultMenuToolbar()
Makes a default menubar and toolbar. Menus: File, Edit, View, Help


adaptDefaultMenuToolbar

public void adaptDefaultMenuToolbar()
Dummy method that can be overridden by sub-classes to adapt the default.


adaptDefaultMenu

public void adaptDefaultMenu()
Dummy method that can be overridden by sub-classes to adapt the default.


adaptDefaultToolbar

public void adaptDefaultToolbar()
Dummy method that can be overridden by sub-classes to adapt the default.


makeFileMenuTool

public javax.swing.JMenu makeFileMenuTool(javax.swing.JComponent parentMenu)
Makes a default file menu and toolbar buttons. Menu items: new, open, save, save as, S, Options, S, close, exit Toolbar buttons: new, open, save


makeFileMenuToolFiles

public void makeFileMenuToolFiles(javax.swing.JMenu fileMenu)
Makes default file new/open/save/saveAs menu items and toolbar buttons. Menu items: new, open, save, save as, S Toolbar buttons: new, open, save


makeFileMenuToolExits

public void makeFileMenuToolExits(javax.swing.JMenu fileMenu)
Makes default close/exit menu options and and toolbar buttons. Menu items: S, close, exit Toolbar buttons: none


makeOptionsMenuTool

public javax.swing.JMenu makeOptionsMenuTool(javax.swing.JComponent parentMenu)
Makes a default options menu and toolbar buttons. Menu items: cut, copy, paste Toolbar buttons: cut, copy, paste


makeEditMenuTool

public javax.swing.JMenu makeEditMenuTool(javax.swing.JComponent parentMenu)
Makes a default edit menu and toolbar buttons. Menu items: cut, copy, paste Toolbar buttons: cut, copy, paste


makeViewMenuTool

public javax.swing.JMenu makeViewMenuTool(javax.swing.JComponent parentMenu)
Makes a default view menu and toolbar buttons. Menu items: none Toolbar buttons: none


makeToolsMenuTool

public javax.swing.JMenu makeToolsMenuTool(javax.swing.JComponent parentMenu)
Makes a default tools menu and toolbar buttons. Menu items: none Toolbar buttons: none


makeHelpMenuTool

public javax.swing.JMenu makeHelpMenuTool(javax.swing.JComponent parentMenu)
Makes a default help menu and toolbar buttons. Menu items: help, manual, about Toolbar buttons: help


placeToolbarButton

public void placeToolbarButton(javax.swing.JButton button,
                               int x)

makeRadioMenuItem

public javax.swing.JRadioButtonMenuItem makeRadioMenuItem(javax.swing.JComponent parent,
                                                          java.lang.String command,
                                                          java.lang.String label)
Makes a radio button menu item and adds it to the given (menu) component.

Parameters:
menuParent - the menu that the item should be added to
command - attached to the item for recognising actions
label - displayed in the menu

makeMenu

public javax.swing.JMenu makeMenu(javax.swing.JComponent parent,
                                  java.lang.String label)
Makes a menu and adds it to the given (menu) component. Sets the accelerator to be the first letter of the label

Parameters:
menuParent - the menu that the item should be added to
label - the name of the menu

actionPerformed

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

close

public void close()

exitApplication

public void exitApplication()

openFile

public void openFile()

userChooseFile

public java.io.File userChooseFile()

saveFile

public void saveFile()

saveFileAs

public void saveFileAs()

saveToFile

public void saveToFile(java.io.File file)
Overwrite this with actual saving.


openFile

public void openFile(java.io.File file)
Overwrite this with actual opening.


toggleToolbar

public void toggleToolbar(boolean on)

exit

public void exit()

aboutDialog

public void aboutDialog()

userManual

public void userManual()

userHelp

public void userHelp()

ensureHelpFrame

public HTMLFrame ensureHelpFrame()