Class PMenuBar

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, MenuElement

public class PMenuBar extends JMenuBar
This is a derivitive of JMenuBar that provides 2 extra capabilities for BAS. First, it can be used as a vertical menu. Second, when BASActions are added, it provides menu merging features.
Version:
%version: 19 % %date_modified: Wed Oct 24 10:19:55 2001 %, %version: 19 % %date_modified: Wed Oct 24 10:19:55 2001 %
Author:
larrylf
See Also:
  • Constructor Details

    • PMenuBar

      public PMenuBar()
      Contruct a default (vertical) MenuBar
    • PMenuBar

      public PMenuBar(boolean vert)
      Contruct a MenuBar instance.
      Parameters:
      vert - Set to true for a vertical menu, or false for a JMenuBar like horizontal menu.
  • Method Details

    • setIcon

      public void setIcon(Icon icn)
      Set an icon to display at the bottom of the menu column
      Parameters:
      icn - The icon to display
    • getIcon

      public Icon getIcon()
      Get the icon displayed at the bottom of the menu column
      Returns:
      The icon displayed
    • getJMenu

      public JMenu getJMenu(String key)
      Get a JMenu from PMenuBar.
      Parameters:
      key - A String to name the JMenu to search for.
      Returns:
      The requested JMenu as defined by key. If the menu is not found null is returned.
    • setImageLoading

      public void setImageLoading(boolean loadImages)
      Set icon image loading.
      Parameters:
      loadImages - Set to true to load associated images along as part of the menu item, or false for no images to be loaded. The default is set to true.
    • add

      public void add(PBASAction a)
      Add a BASAction to the menu. This function provides full menu merging capabilities. If there is already a menu item with the same name, then the action is added to the list of actions called when the item is selected. The BASAction class provides a 'preferred menu' string. This is a non-localized string like 'file' or 'edit'. The actual localized name put on the menubar is determined by pre-pending the name with this classes resource base string, and looking up that resource in the main resource properties file.
      Parameters:
      a - A BASAction to add to the menu
    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • remove

      public void remove(PBASAction a)
      Remove a BASAction from the menu. If there are more then one menu item with the same name, then this action is just removed from the list of actions to call. If it is the last such, then the menu item is removed from the menu.
      Parameters:
      a - The BASAction to remove.
    • setEnabled

      public void setEnabled(boolean b)
      Override setEnabled to affect each menu in the menubar
      Overrides:
      setEnabled in class JComponent
      Parameters:
      b - the desired state of the menubar
    • setResourceBase

      public void setResourceBase(String base)
      The the resource base string. THis string is prepended to the menu name to determin the resource to look up to find the actual localized string to label the menu with.
      Parameters:
      base - The resource base string.
    • getResourceBase

      public String getResourceBase()
      Get the resource base string.
      Returns:
      A string containing the resource base
    • add

      public void add(Vector v)
      Will add a whole vector of BASActions to the menu.
      Parameters:
      v - A vector of PBASActions
    • remove

      public void remove(Vector v)
      Will remove a whole vector of BASActions from the menu.
      Parameters:
      v - A vector of PBASActions