optics.graphics
Class Diagram2DFrame

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 optics.graphics.Diagram2DFrame
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
ImageFrame, Interferometer, SpotDiagram

public class Diagram2DFrame
extends JFrame

Main Frame for display of Diagram2DPanel in frame being a default JFrame with curstom basic menu to control pen width, font size, and save options. The frame will be set to have BoarderLayout and the Diagram2DPanel will be set in the centre panel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Container frame
           
 ActionListener handler
          Public access to local handler
protected  Color menuColour
           
protected  JMenu optionsMenu
          Options menu with public access to make it easy to add to.
protected  Diagram2DPanel panel
          The panel containing the Diagram2D that is being displayed
protected  JLabel statusBar
          Lower status bar, by default switched off.
 
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
Diagram2DFrame(String title)
          Form Diagram2DFrame with specifed title and no internal displayable panel.
Diagram2DFrame(String title, Diagram2D diagram)
          Form a Diagram2DFrame with specified title and displayable Diagram2D, the Diagram2DPanel will be automatically created
Diagram2DFrame(String title, Diagram2DPanel panel)
          Form a Diagram2DFrame with specified title and displayable Diagram2DPanel displayable panel.
 
Method Summary
 void addPanel(Diagram2DPanel p)
          Method to add a Diagram2DPanel to the frame.
 void addStatusBar(String s)
          Method to add a status bar in a SOUTH Jpanel with a preset text.
 void centre()
          Centre the frame on the current display (should work for all display sizes)
 void extraButtons(ActionEvent e)
          Method to implement extra buttons, can be overloaded in extending classes.
 ActionListener getActionListener()
          Method to get the ActionListener
 JMenu getMainMenu()
          Method to get the main menu so that additiona items can be adde
 JMenu getOptionsMenu()
          Method to geet the options menus so additional items can be added.
 Diagram2DPanel getPanel()
          Method to get the Diagram2DPanel display in the frame
static void main(String[] args)
          Test method to read in an OpticalGroup and display in the Frame
 void setStatusBarText(String s)
          Method stub to set a status bar text.
 
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, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, 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, 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

frame

protected Container frame

menuColour

protected Color menuColour

statusBar

protected JLabel statusBar
Lower status bar, by default switched off.


optionsMenu

protected JMenu optionsMenu
Options menu with public access to make it easy to add to.


handler

public ActionListener handler
Public access to local handler


panel

protected Diagram2DPanel panel
The panel containing the Diagram2D that is being displayed

Constructor Detail

Diagram2DFrame

public Diagram2DFrame(String title,
                      Diagram2D diagram)
Form a Diagram2DFrame with specified title and displayable Diagram2D, the Diagram2DPanel will be automatically created

Parameters:
title - the frame title
diagram - the Diagram2D display in the frame

Diagram2DFrame

public Diagram2DFrame(String title,
                      Diagram2DPanel panel)
Form a Diagram2DFrame with specified title and displayable Diagram2DPanel displayable panel.

Initial frame will be size 0,0 and not visible, usr the standard JFrame .setSize(x,y) and .setVisible(true) to display the frame.

Parameters:
title - the frame title
panel - the displayable panel.

Diagram2DFrame

public Diagram2DFrame(String title)
Form Diagram2DFrame with specifed title and no internal displayable panel. The frame will be set to BorderLayout with the diagram panel in the centre.

Initial frame will be size 0,0 and not visible, usr the standard JFrame .setSize(x,y) and .setVisible(true) yo display the frame.

A displayable panel must be added before this class is rendered visible or null Exceptions may occur.

Parameters:
title - the frame title
Method Detail

addPanel

public void addPanel(Diagram2DPanel p)
Method to add a Diagram2DPanel to the frame. Added panel will be added to the frame with a default JFrame.add to the BorderLayout.CENTER of the frame.

Parameters:
p - the panel

getPanel

public Diagram2DPanel getPanel()
Method to get the Diagram2DPanel display in the frame

Returns:
Diagram2DPanel the displayed panel.

getActionListener

public ActionListener getActionListener()
Method to get the ActionListener


addStatusBar

public void addStatusBar(String s)
Method to add a status bar in a SOUTH Jpanel with a preset text.

Parameters:
s - the status bar string.

setStatusBarText

public void setStatusBarText(String s)
Method stub to set a status bar text.

Parameters:
s - the status bar sString

getMainMenu

public JMenu getMainMenu()
Method to get the main menu so that additiona items can be adde


getOptionsMenu

public JMenu getOptionsMenu()
Method to geet the options menus so additional items can be added.


centre

public void centre()
Centre the frame on the current display (should work for all display sizes)


extraButtons

public void extraButtons(ActionEvent e)
Method to implement extra buttons, can be overloaded in extending classes.


main

public static void main(String[] args)
Test method to read in an OpticalGroup and display in the Frame