com.quadrique.jbuildingblocks.gui
Class MainWindowBase
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
com.quadrique.jbuildingblocks.gui.MainWindowBase
- All Implemented Interfaces:
- WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
public abstract class MainWindowBase
- extends JFrame
- implements WindowListener
This class is the base class for the main window of an
application and it provides common generic services
- Author:
- Hervé Rivere
- See Also:
- Serialized Form
| 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 |
|
Constructor Summary |
MainWindowBase(String zLogFile,
String zConfigFile,
String zFrameTitle,
String zFrameIconName)
other constructor to set up the instance without the online help support i.e. |
MainWindowBase(String zLogFile,
String zConfigFile,
String zHelpSetFile,
String zFrameTitle,
String zFrameIconName,
String zIdForHelpKey)
constructor to set up the instance as well as the log file, user preferences, look and feel, online
help, selection handler and resource instances |
| Methods inherited from class javax.swing.JFrame |
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, 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, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
PREF_LOG_LEVEL
public static final String PREF_LOG_LEVEL
- constants
- See Also:
- Constant Field Values
PREF_LF_CLASS_NAME
public static final String PREF_LF_CLASS_NAME
- See Also:
- Constant Field Values
PREF_LF_EXTENSION_NAME
public static final String PREF_LF_EXTENSION_NAME
- See Also:
- Constant Field Values
PREF_WINDOW_X
public static final String PREF_WINDOW_X
- See Also:
- Constant Field Values
PREF_WINDOW_Y
public static final String PREF_WINDOW_Y
- See Also:
- Constant Field Values
PREF_WINDOW_WIDTH
public static final String PREF_WINDOW_WIDTH
- See Also:
- Constant Field Values
PREF_WINDOW_HEIGHT
public static final String PREF_WINDOW_HEIGHT
- See Also:
- Constant Field Values
MainWindowBase
public MainWindowBase(String zLogFile,
String zConfigFile,
String zHelpSetFile,
String zFrameTitle,
String zFrameIconName,
String zIdForHelpKey)
throws Exception
- constructor to set up the instance as well as the log file, user preferences, look and feel, online
help, selection handler and resource instances
- Parameters:
zLogFile - the relative name (the file will be located unser $USER_HOME) of the log file to use for the applicationzConfigFile - the relative name (the file will be located unser $USER_HOME) of the configuration filezHelpSetFile - the name oft he help set file (use other constructor if you don't need the online help)
help system or if you don't have a help set file available yetzFrameTitle - the title of the framezFrameIconName - the icon file name, the actual icon will be loaded with the Resources classzIdForHelpKey - the key corresponding to the global help
topic (i.e. the topic to diplay when the "Help" is activated) in online help .
- Throws:
Exception - whenever an error occurs
MainWindowBase
public MainWindowBase(String zLogFile,
String zConfigFile,
String zFrameTitle,
String zFrameIconName)
throws Exception
- other constructor to set up the instance without the online help support i.e. no need to
download the java help jar files)
- Parameters:
zLogFile - the relative name (the file will be located unser $USER_HOME) of the log file to use for the applicationzConfigFile - the relative name (the file will be located unser $USER_HOME) of the configuration filezFrameTitle - the title of the framezFrameIconName - the icon file name, the actual icon will be loaded with the Resources class
- Throws:
Exception - whenever an error occurs
setPositionAndSize
public void setPositionAndSize(int zMinimumScreenWidth,
int zMinimumScreenHeight)
throws Exception
- to set up the main window position and size.
The method first check that the screen is large enough to display the application.
The method then sets the main window position and size using either default values (the
first time the application is launched) or the previous main window position and size
- Parameters:
zMinimumScreenWidth - the min scren width in number of pixelszMinimumScreenHeight - the min screen height in number fo pixels
- Throws:
Exception
getActions
public Actions getActions()
- Returns:
- the set of actions
addMenuAndToolBar
public void addMenuAndToolBar(JComponent zMenuBar,
JComponent zToolBar)
- Parameters:
zMenuBar - the menu barzToolBar - the tool bar
addCenterComponent
public void addCenterComponent(JComponent zComponent)
- Parameters:
zComponent - the component to add to the center of the main window
addStatusBar
public void addStatusBar(JComponent zStatusBar)
- Parameters:
zStatusBar - the status bar
savePreferences
public void savePreferences()
throws Exception
- save the preferences
- Throws:
Exception - if an error occurs while trying to save the preferences
windowOpened
public void windowOpened(WindowEvent event)
- Specified by:
windowOpened in interface WindowListener
- Parameters:
event - the window event
windowClosing
public void windowClosing(WindowEvent event)
- Specified by:
windowClosing in interface WindowListener
windowClosed
public void windowClosed(WindowEvent event)
- Specified by:
windowClosed in interface WindowListener
windowIconified
public void windowIconified(WindowEvent e)
- Specified by:
windowIconified in interface WindowListener
windowDeiconified
public void windowDeiconified(WindowEvent e)
- Specified by:
windowDeiconified in interface WindowListener
windowActivated
public void windowActivated(WindowEvent e)
- Specified by:
windowActivated in interface WindowListener
windowDeactivated
public void windowDeactivated(WindowEvent e)
- Specified by:
windowDeactivated in interface WindowListener
exit
public void exit()
- implements the following default behavior:
- save the current main window position and size so that it can be used when the application will be restarted
- save the preferences in a file sot hat they can be retrieved when the application is restarted
- terminate the application by calling "System.exit(0);"
Feel free to override it in your derived class (but we recommend then that you call "super.exit(true)" to make sure that the
framework is properly terminated.
Copyright © 2001-2009 Quadrique Corporation. All Rights Reserved.