Help
Class Help

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--Help.Help

public class Help
extends Frame
implements WindowListener

This is the class that provides the frame in which we draw the help.

Version:
1.0
Author:
Sebastien
See Also:
Serialized Form

Field Summary
protected  boolean helpFileProblem
          This is a boolean to know if the help file has been correctly read or not.
protected  boolean helpFrameOpen
          We can know if the frame is open or not.
protected  HelpImageCanvas helpImageCanvas
          The canvas in which we draw the image.
protected  Panel indexNorthPanel
          The panel that contains the main menu index and its label.
protected  Panel indexPanel
          The panel that contains the indexes.
protected  Panel indexSouthPanel
          The panel that contains the sub menu index and its label.
protected  List mainIndex
          The menu list.
protected  ActionListener mainIndexActionListener
          Actionlistener for the menu list.
protected  Panel mainPanel
          The panel that contains the image and the index.
protected  MyMenu[] menu
          The structure in which there is the help.
protected  Label menuIndex
          The label for the menu list.
protected  Panel menuIndexPanel
          The panel that contains the main menu index.
protected  String problemString
          This is a string to tell the user what's wrong with the help file.
protected  List subIndex
          The sub menu list
protected  ActionListener subIndexActionListener
          Actionlistener for the sub menu list.
protected  Label subMenuIndex
          The label for the sub menu list.
protected  Panel subMenuIndexPanel
          The panel that contains the sub menu index.
protected  TextArea textArea
          The area in which we draw the help.
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, 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
 
Constructor Summary
Help(String fileName)
          The main constructor.
Help(URL fileName)
          The main constructor.
 
Method Summary
 boolean helpFrameOpen()
          If the help frame is open or not.
 void init()
          Init of our frame used when we have a nullpointerexception.
 void init(Image image)
          Init of our frame.
protected  void initActionListener()
          This method init the different action listener of the lists.
protected  void initListsItems()
          We create the title in the main menu.
 MyMenu[] menu()
          This method returns the structures of all the different menus.
protected  MyMenu[] readStructure(String fileName)
          This method read the structure of a help file that has been parsed by the HelpFileParser.
protected  MyMenu[] readStructure(URL fileName)
          This method read the structure of a help file that has been parsed by the HelpFileParser.
 void setText(String string)
          This method set a help message on the TextArea with a specified color.
 void start()
          This method show the frame with the right size.
 void updateSubList(int index)
          This method updates the sublist with the right menu.
 void updateSubText(int menuIndex, int subMenuIndex)
          This method display the help message corresponding to the sub title that the user has clicked on.
 void windowActivated(WindowEvent e)
          When you activate the window.
 void windowClosed(WindowEvent e)
          When you close the window.
 void windowClosing(WindowEvent e)
          To close the window.
 void windowDeactivated(WindowEvent e)
          When you deactivate the window.
 void windowDeiconified(WindowEvent e)
          When you deiconify the window.
 void windowIconified(WindowEvent e)
          When you iconify the window.
 void windowOpened(WindowEvent e)
          When you open the window.
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, paramString, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mainIndex

protected List mainIndex
The menu list.

subIndex

protected List subIndex
The sub menu list

textArea

protected TextArea textArea
The area in which we draw the help.

menu

protected MyMenu[] menu
The structure in which there is the help.

menuIndex

protected Label menuIndex
The label for the menu list.

subMenuIndex

protected Label subMenuIndex
The label for the sub menu list.

indexPanel

protected Panel indexPanel
The panel that contains the indexes.

mainPanel

protected Panel mainPanel
The panel that contains the image and the index.

indexNorthPanel

protected Panel indexNorthPanel
The panel that contains the main menu index and its label.

menuIndexPanel

protected Panel menuIndexPanel
The panel that contains the main menu index.

indexSouthPanel

protected Panel indexSouthPanel
The panel that contains the sub menu index and its label.

subMenuIndexPanel

protected Panel subMenuIndexPanel
The panel that contains the sub menu index.

mainIndexActionListener

protected ActionListener mainIndexActionListener
Actionlistener for the menu list.

subIndexActionListener

protected ActionListener subIndexActionListener
Actionlistener for the sub menu list.

helpImageCanvas

protected HelpImageCanvas helpImageCanvas
The canvas in which we draw the image.

helpFrameOpen

protected boolean helpFrameOpen
We can know if the frame is open or not.

helpFileProblem

protected boolean helpFileProblem
This is a boolean to know if the help file has been correctly read or not.

problemString

protected String problemString
This is a string to tell the user what's wrong with the help file.
Constructor Detail

Help

public Help(URL fileName)
The main constructor. It creates all the panel and get the help from a file that was parsed with the help file parser.
Parameters:
fileName - The fileName of the help file.
See Also:
HelpFileParser

Help

public Help(String fileName)
The main constructor. It creates all the panel and get the help from a file that was parsed with the help file parser.
Parameters:
fileName - The fileName of the help file.
See Also:
HelpFileParser
Method Detail

init

public void init(Image image)
Init of our frame.
Parameters:
image - The image that we will display in our frame.

init

public void init()
Init of our frame used when we have a nullpointerexception.

start

public void start()
This method show the frame with the right size.

initActionListener

protected void initActionListener()
This method init the different action listener of the lists.

initListsItems

protected void initListsItems()
We create the title in the main menu.

updateSubList

public void updateSubList(int index)
This method updates the sublist with the right menu. It draws in the textarea a help message.
Parameters:
index - The number of the menu that the user has clicked on.

updateSubText

public void updateSubText(int menuIndex,
                          int subMenuIndex)
This method display the help message corresponding to the sub title that the user has clicked on.
Parameters:
menuIndex - The main menu index.
subMenuIndex - The index of the sub menu the user has clicked on.

readStructure

protected MyMenu[] readStructure(String fileName)
This method read the structure of a help file that has been parsed by the HelpFileParser.
Parameters:
fileName - The name of the file we want to get the structure.
Returns:
The menu structure.
See Also:
HelpFileParser, MyMenu

readStructure

protected MyMenu[] readStructure(URL fileName)
This method read the structure of a help file that has been parsed by the HelpFileParser.
Parameters:
fileName - The name of the file we want to get the structure.
Returns:
The menu structure.
See Also:
HelpFileParser, MyMenu

setText

public void setText(String string)
This method set a help message on the TextArea with a specified color.
Parameters:
string - The help message.
color - The color of the help message.

menu

public MyMenu[] menu()
This method returns the structures of all the different menus.
Returns:
The menu structure.
See Also:
MyMenu

helpFrameOpen

public boolean helpFrameOpen()
If the help frame is open or not.
Returns:
True if the frame is open. False otherwise.

windowClosing

public void windowClosing(WindowEvent e)
To close the window.
Specified by:
windowClosing in interface WindowListener
Parameters:
e - The window event.

windowOpened

public void windowOpened(WindowEvent e)
When you open the window.
Specified by:
windowOpened in interface WindowListener
Parameters:
e - The window event.

windowIconified

public void windowIconified(WindowEvent e)
When you iconify the window.
Specified by:
windowIconified in interface WindowListener
Parameters:
e - The window event.

windowDeiconified

public void windowDeiconified(WindowEvent e)
When you deiconify the window.
Specified by:
windowDeiconified in interface WindowListener
Parameters:
e - The window event.

windowDeactivated

public void windowDeactivated(WindowEvent e)
When you deactivate the window.
Specified by:
windowDeactivated in interface WindowListener
Parameters:
e - The window event.

windowClosed

public void windowClosed(WindowEvent e)
When you close the window.
Specified by:
windowClosed in interface WindowListener
Parameters:
e - The window event.

windowActivated

public void windowActivated(WindowEvent e)
When you activate the window.
Specified by:
windowActivated in interface WindowListener
Parameters:
e - The window event.