MakeLogicTM - FileMenu API
v1.1

com.makeLogic.utils
Class FileMenu

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JMenuItem
                                |
                                +--javax.swing.JMenu
                                      |
                                      +--com.makeLogic.utils.FileMenu
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, javax.swing.MenuElement, java.io.Serializable, javax.swing.SwingConstants

public class FileMenu
extends javax.swing.JMenu

A convenience implementation of FileMenu that creates all MenuItems like
New
Open
Save
SaveAs
RecentFiles
Exit
with their functionality which are required for the FileMenu Creation.
FileMenu with all its Functionality can be added easily using the following simple code

Example - create a new fileMenu that collects all MenuItems

JDesktopPane desktop = new JDesktopPane();
JMenuBar menuBar = new JMenuBar();
FileMenu fileMenu = new FileMenu(desktop);
menuBar.add(fileMenu);

 

Version:
1.1 17/11/2003
Author:
R.Venkatesh
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JMenu
javax.swing.JMenu.AccessibleJMenu, javax.swing.JMenu.WinListener
 
Nested classes inherited from class javax.swing.JMenuItem
javax.swing.JMenuItem.AccessibleJMenuItem
 
Nested classes inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static RecentFilesMenuItem recentFilesMenuItem
           
 
Fields inherited from class javax.swing.JMenu
popupListener
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FileMenu(java.awt.Container container)
          Builds a FileMenu object which must be added to the MenuBar.
FileMenu(java.awt.Container container, javax.swing.KeyStroke newMenuItemKeyStroke, javax.swing.KeyStroke openMenuItemKeyStroke, javax.swing.KeyStroke saveMenuItemKeyStroke, javax.swing.KeyStroke saveAsMenuItemKeyStroke, char recentFilesMenuItemKeyStroke, javax.swing.KeyStroke exitMenuItemKeyStroke)
          Builds a FileMenu object with userdefined KeyStrokes.
 
Method Summary
 void addExitMenuItemActionListener(java.awt.event.ActionListener exitMenuItemActionListener)
          adds the ActionListener to the ExitMenuItem
 void addNewMenuItemActionListener(java.awt.event.ActionListener newMenuItemActionListener)
          adds the ActionListener to the NewMenuItem
 void addOpenMenuItemActionListener(java.awt.event.ActionListener openMenuItemActionListener)
          adds the ActionListener to the OpenMenuItem
 void addRecentFilesMenuItemActionListener(java.awt.event.ActionListener recentFilesMenuItemActionListener)
          adds the ActionListener to the RecentFilesMenuItem
 void addSaveAsMenuItemActionListener(java.awt.event.ActionListener saveAsMenuItemActionListener)
          adds the ActionListener to the SaveAsMenuItem
 void addSaveMenuItemActionListener(java.awt.event.ActionListener saveMenuItemActionListener)
          adds the ActionListener to the SaveMenuItem
 void disableDefaultExitMenuItemListener()
          Disables the default Listener of the ExitMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.
 void disableDefaultNewMenuItemListener()
          Disables the default Listener of the NewMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.
 void disableDefaultOpenMenuItemListener()
          Disables the default Listener of the OpenMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.
 void disableDefaultRecentFilesMenuItemListener()
          Disables the default Listener of the RecentFileMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.
 void disableDefaultSaveAsMenuItemListener()
          Disables the default Listener of the SaveAsMenuItem developed by the Listener so that user can write his own Handler and use it for his purpose.
 void disableDefaultSaveMenuItemListener()
          Disables the default Listener of the SaveMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.
 java.awt.event.WindowListener getDefaultClosingListener()
          returns the WindowListener which handles the windowclosing
event of the Window object, It takes care of File Saving,etc.,
before closing.The user can directly call it in his addwindowListener() method;
 javax.swing.JMenuItem getExitMenuItem()
          returns the JMenuItem Object
 int getMaxEntriesInConfFile()
          gets the MaxEntries in Conf File
 int getMaxEntriesInRecentFilesMenu()
          gets the MaxEntries in RecentFilesMenu
 javax.swing.JMenuItem getNewMenuItem()
          returns the NewMenuItem Object
 javax.swing.JMenuItem getOpenMenuItem()
          returns the JMenuItem Object
static javax.swing.JMenu getRecentFilesMenuItem()
          returns the JMenu Object
 javax.swing.JMenuItem getSaveAsMenuItem()
          returns the JMenuItem Object
static javax.swing.JMenuItem getSaveMenuItem()
          returns the JMenuItem Object
 void setKeyStrokeForExitMenuItem(javax.swing.KeyStroke exitMenuItemKeyStroke)
          sets the userdefined KeyStroke to the ExitKeyStroke.
 void setKeyStrokeForNewMenuItem(javax.swing.KeyStroke newMenuItemKeyStroke)
          sets the userdefined KeyStroke to the NewMenuItem.
 void setKeyStrokeForOpenMenuItem(javax.swing.KeyStroke openMenuItemKeyStroke)
          sets the userdefined KeyStroke to the OpenMenuItem.
 void setKeyStrokeForRecentFilesMenuItem(char recentFilesMenuItemKeyStroke)
          sets the userdefined KeyStroke to the RecentFilesMenuItems.
 void setKeyStrokeForSaveAsMenuItem(javax.swing.KeyStroke saveAsMenuItemKeyStroke)
          sets the userdefined KeyStroke to the SaveAsMenuItem.
 void setKeyStrokeForSaveMenuItem(javax.swing.KeyStroke saveMenuItemKeyStroke)
          sets the userdefined KeyStroke to the SaveMenuItem.
 void setMaxEntriesInConfFile(int maxEntriesInConfFile)
          sets the MaxEntries in Conf File
 void setMaxEntriesInRecentFilesMenu(int maxEntriesInRecentFilesMenu)
          sets the MaxEntries in RecentFile Menu
 
Methods inherited from class javax.swing.JMenu
add, add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, configurePropertiesFromAction, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI
 
Methods inherited from class javax.swing.JMenuItem
addMenuDragMouseListener, addMenuKeyListener, createActionPropertyChangeListener, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setEnabled, setUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, addContainerListener, addImpl, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, 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 javax.swing.MenuElement
processKeyEvent, processMouseEvent
 

Field Detail

recentFilesMenuItem

public static RecentFilesMenuItem recentFilesMenuItem
Constructor Detail

FileMenu

public FileMenu(java.awt.Container container)
Builds a FileMenu object which must be added to the MenuBar. Adds the MenuItems to the FileMenu and keeps it ready for use.

Parameters:
container - contianer is any java.awt.Container but here container should be JDesktopPane,JFrame,etc., because javax.swing.JInternalFrame objects are added to it.

Example:-

JDesktopPane desktop = new JDesktopPane();
JMenuBar menuBar = new JMenuBar();
FileMenu fileMenu = new FileMenu(desktop);
menuBar.add(fileMenu);
 

For Example:-

See sample

FileMenu

public FileMenu(java.awt.Container container,
                javax.swing.KeyStroke newMenuItemKeyStroke,
                javax.swing.KeyStroke openMenuItemKeyStroke,
                javax.swing.KeyStroke saveMenuItemKeyStroke,
                javax.swing.KeyStroke saveAsMenuItemKeyStroke,
                char recentFilesMenuItemKeyStroke,
                javax.swing.KeyStroke exitMenuItemKeyStroke)
Builds a FileMenu object with userdefined KeyStrokes.

Parameters:
container - Container is any java.awt.Container but in our case it should be JDesktopPane,JFrame,etc., because javax.swing.JInternalFrames are added to it.
newMenuItemKeyStroke - is javax.swing.KeyStroke object.
openMenuItemKeyStroke - is javax.swing.KeyStroke object.
saveMenuItemKeyStroke - is javax.swing.KeyStroke object.
saveAsMenuItemKeyStroke - is javax.swing.KeyStroke object.
recentFilesMenuItemKeyStroke - is javax.swing.KeyStroke object.
exitMenuItemKeyStroke - is javax.swing.KeyStroke object.

Example:-

JDesktopPane desktop = new JDesktopPane();


javax.swing.KeyStroke newKeyStroke=KeyStroke.getKeyStroke('U',java.awt.Event.CTRL_MASK,false);
javax.swing.KeyStroke openKeyStroke=KeyStroke.getKeyStroke('V',java.awt.Event.CTRL_MASK,false);
javax.swing.KeyStroke saveKeyStroke=KeyStroke.getKeyStroke('W',java.awt.Event.CTRL_MASK,false);
javax.swing.KeyStroke saveAsKeyStroke=KeyStroke.getKeyStroke('X',java.awt.Event.CTRL_MASK,false);
javax.swing.KeyStroke recentFilesKeyStroke=KeyStroke.getKeyStroke('Y',java.awt.Event.CTRL_MASK,false);
javax.swing.KeyStroke exitMenuItemKeyStroke=KeyStroke.getKeyStroke('Z',java.awt.Event.CTRL_MASK,false);

JMenuBar menuBar = new JMenuBar();

FileMenu fileMenu = new FileMenu(desktop,newMenuItemKeyStroke,openMenuItemKeyStroke,saveMenuKeystroke,saveAsMenuItemKeyStroke,recentFileMenuItemKeyStroke,exitMenuItemKeyStroke);

menuBar.add(fileMenu);
 

For Example:-

See sample
Method Detail

setKeyStrokeForNewMenuItem

public void setKeyStrokeForNewMenuItem(javax.swing.KeyStroke newMenuItemKeyStroke)
sets the userdefined KeyStroke to the NewMenuItem.

Parameters:
newMenuItemKeyStroke - is any javax.swing.KeyStroke.

Example:-

JDesktopPane desktop =new JDesktopPane();
FileMenu fileMenu=new FileMenu(desktop);
javax.swing.KeyStroke newMenuItemKeyStroke=KeyStroke.getKeyStroke('U',java.awt.Event.CTRL_MASK,false);

fileMenu.setKeyStrokeForNewMenuItem(newMenuItemKeyStroke);

For Example:-

See sample

setKeyStrokeForOpenMenuItem

public void setKeyStrokeForOpenMenuItem(javax.swing.KeyStroke openMenuItemKeyStroke)
sets the userdefined KeyStroke to the OpenMenuItem.

For Example:-

See sample

Parameters:
openMenuItemKeyStroke - is any javax.swing.KeyStroke.
See Also:
Example, setKeyStrokeForNewMenuItem(javax.swing.KeyStroke)

setKeyStrokeForSaveMenuItem

public void setKeyStrokeForSaveMenuItem(javax.swing.KeyStroke saveMenuItemKeyStroke)
sets the userdefined KeyStroke to the SaveMenuItem.

For Example:-

See sample

Parameters:
saveMenuItemKeyStroke - is any javax.swing.KeyStroke.
See Also:
Example, setKeyStrokeForNewMenuItem(javax.swing.KeyStroke)

setKeyStrokeForSaveAsMenuItem

public void setKeyStrokeForSaveAsMenuItem(javax.swing.KeyStroke saveAsMenuItemKeyStroke)
sets the userdefined KeyStroke to the SaveAsMenuItem.

For Example:-

See sample

Parameters:
saveAsMenuItemKeyStroke - is any javax.swing.KeyStroke.
See Also:
Example, setKeyStrokeForNewMenuItem(javax.swing.KeyStroke)

setKeyStrokeForRecentFilesMenuItem

public void setKeyStrokeForRecentFilesMenuItem(char recentFilesMenuItemKeyStroke)
sets the userdefined KeyStroke to the RecentFilesMenuItems.

For Example:-

See sample

Parameters:
recentFilesMenuItemKeyStroke - is any javax.lang.char.

setKeyStrokeForExitMenuItem

public void setKeyStrokeForExitMenuItem(javax.swing.KeyStroke exitMenuItemKeyStroke)
sets the userdefined KeyStroke to the ExitKeyStroke.

For Example:-

See sample

Parameters:
exitMenuItemKeyStroke - is any javax.swing.KeyStroke.
See Also:
Example, setKeyStrokeForNewMenuItem(javax.swing.KeyStroke)

addNewMenuItemActionListener

public void addNewMenuItemActionListener(java.awt.event.ActionListener newMenuItemActionListener)
adds the ActionListener to the NewMenuItem

For Example:-

See sample

Parameters:
newMenuItemActionListener - is a variable of type ActionListener
See Also:
disableDefaultNewMenuItemListener()

addOpenMenuItemActionListener

public void addOpenMenuItemActionListener(java.awt.event.ActionListener openMenuItemActionListener)
adds the ActionListener to the OpenMenuItem

For Example:-

See sample

Parameters:
openMenuItemActionListener - is a variable of type ActionListener
See Also:
disableDefaultOpenMenuItemListener()

addSaveMenuItemActionListener

public void addSaveMenuItemActionListener(java.awt.event.ActionListener saveMenuItemActionListener)
adds the ActionListener to the SaveMenuItem

For Example:-

See sample

Parameters:
saveMenuItemActionListener - is a variable of type ActionListener
See Also:
disableDefaultSaveMenuItemListener()

addSaveAsMenuItemActionListener

public void addSaveAsMenuItemActionListener(java.awt.event.ActionListener saveAsMenuItemActionListener)
adds the ActionListener to the SaveAsMenuItem

For Example:-

See sample

Parameters:
saveAsMenuItemActionListener - is a variable of type ActionListener
See Also:
disableDefaultSaveAsMenuItemListener()

addRecentFilesMenuItemActionListener

public void addRecentFilesMenuItemActionListener(java.awt.event.ActionListener recentFilesMenuItemActionListener)
adds the ActionListener to the RecentFilesMenuItem

For Example:-

See sample

Parameters:
recentFilesMenuItemActionListener - is a variable of type ActionListener
See Also:
disableDefaultRecentFilesMenuItemListener()

addExitMenuItemActionListener

public void addExitMenuItemActionListener(java.awt.event.ActionListener exitMenuItemActionListener)
adds the ActionListener to the ExitMenuItem

For Example:-

See sample

Parameters:
exitMenuItemActionListener - is a variable of type ActionListener
See Also:
disableDefaultExitMenuItemListener()

disableDefaultNewMenuItemListener

public void disableDefaultNewMenuItemListener()
Disables the default Listener of the NewMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.

Example:-

The Following code will disable the Default Listener developed by the Developer and calls its own Listener

JMenuBar menuBar =new JMenuBar();
JDesktopPane desktop=new JDesktopPane();

FileMenu fileMenu=new FileMenu(desktop);

//..disable default Handlers
fileMenu.disableDefaultNewMenuItemListener();
//..add Listener
fileMenu.addNewMenuItemActionListener(this);


//..add the fileMenu object to the JMenuBar
menuBar.add(fileMenu);
//..adds the MenuBar to the frame
setJMenuBar(menuBar);
 

For Example:-

See sample

See Also:
addNewMenuItemActionListener(java.awt.event.ActionListener)

disableDefaultOpenMenuItemListener

public void disableDefaultOpenMenuItemListener()
Disables the default Listener of the OpenMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.

For Example:-

See sample

See Also:
addOpenMenuItemActionListener(java.awt.event.ActionListener), disableDefaultNewMenuItemListener()

disableDefaultSaveMenuItemListener

public void disableDefaultSaveMenuItemListener()
Disables the default Listener of the SaveMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.

For Example:-

See sample

See Also:
addSaveMenuItemActionListener(java.awt.event.ActionListener), disableDefaultNewMenuItemListener()

disableDefaultSaveAsMenuItemListener

public void disableDefaultSaveAsMenuItemListener()
Disables the default Listener of the SaveAsMenuItem developed by the Listener so that user can write his own Handler and use it for his purpose.

For Example:-

See sample

See Also:
addSaveAsMenuItemActionListener(java.awt.event.ActionListener), disableDefaultNewMenuItemListener()

disableDefaultRecentFilesMenuItemListener

public void disableDefaultRecentFilesMenuItemListener()
Disables the default Listener of the RecentFileMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.

For Example:-

See sample

See Also:
disableDefaultNewMenuItemListener()

disableDefaultExitMenuItemListener

public void disableDefaultExitMenuItemListener()
Disables the default Listener of the ExitMenuItem developed by the developer so that user can write his own Listener and use it for his purpose.

For Example:-

See sample

See Also:
addExitMenuItemActionListener(java.awt.event.ActionListener), disableDefaultNewMenuItemListener()

getMaxEntriesInConfFile

public int getMaxEntriesInConfFile()
gets the MaxEntries in Conf File

For Example:-

See sample

Returns:
maxEntriesInConfFile

getMaxEntriesInRecentFilesMenu

public int getMaxEntriesInRecentFilesMenu()
gets the MaxEntries in RecentFilesMenu

For Example:-

See sample

Returns:
maxEntriesInRecentFileMenu

setMaxEntriesInConfFile

public void setMaxEntriesInConfFile(int maxEntriesInConfFile)
sets the MaxEntries in Conf File

For Example:-

See sample


setMaxEntriesInRecentFilesMenu

public void setMaxEntriesInRecentFilesMenu(int maxEntriesInRecentFilesMenu)
sets the MaxEntries in RecentFile Menu

For Example:-

See sample

Parameters:
maxEntriesInRecentFilesMenu - is an int

getDefaultClosingListener

public java.awt.event.WindowListener getDefaultClosingListener()
returns the WindowListener which handles the windowclosing
event of the Window object, It takes care of File Saving,etc.,
before closing.The user can directly call it in his addwindowListener() method;

For Example:-

See sample


getNewMenuItem

public javax.swing.JMenuItem getNewMenuItem()
returns the NewMenuItem Object

Returns:
newMenuItem

getOpenMenuItem

public javax.swing.JMenuItem getOpenMenuItem()
returns the JMenuItem Object

Returns:
OpenMenuItem

getSaveMenuItem

public static javax.swing.JMenuItem getSaveMenuItem()
returns the JMenuItem Object

Returns:
SaveMenuItem

getSaveAsMenuItem

public javax.swing.JMenuItem getSaveAsMenuItem()
returns the JMenuItem Object

Returns:
SaveAsMenuItem

getRecentFilesMenuItem

public static javax.swing.JMenu getRecentFilesMenuItem()
returns the JMenu Object

Returns:
RecentFilesMenuItem

getExitMenuItem

public javax.swing.JMenuItem getExitMenuItem()
returns the JMenuItem Object

Returns:
ExitMenuItem

MakeLogicTM - FileMenu API
v1.1

Submit a bug or feature

MakeLogic is a trademark or regis.
Copyright 2002 MakeLogic. 19-111/1,Gauthamnagar,Malkajgiri,Hyderabad, AP, India