public class MenuBar
ImplementsActionListener, Animation, Editable, Iterable<Component>, StyleListener
Known subtypesSideMenuBar
Constructors
public MenuBar() |
Methods
protected void initMenuBar(Form parent) | Initialize the MenuBar |
public void removeEmptySoftbuttons() | This method removes empty J2ME softbuttons that don’t have a command |
public int getCommandBehavior() | |
public Command getDefaultCommand() | Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. |
public void setDefaultCommand(Command defaultCommand) | Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. |
public Command getClearCommand() | Indicates the command that is defined as the clear command in this form. |
public void setClearCommand(Command clearCommand) | Indicates the command that is defined as the clear command in this form. |
public Button findCommandComponent(Command c) | Find the command component instance if such an instance exists |
public Command getBackCommand() | Indicates the command that is defined as the back command out of this form. |
public void setBackCommand(Command backCommand) | Indicates the command that is defined as the back command out of this form. |
public Command getSelectCommand() | The selectCommand is the command to invoke when a Component has foucs in Third Soft Button state. |
public void setSelectCommand(Command selectCommand) | Sets the select command |
public void actionPerformed(ActionEvent evt) | Invoked when a softbutton is pressed |
protected Button createSoftButton(String uiid) | Creates a soft button Component |
public void setUnselectedStyle(Style style) | Changes the Component Style by replacing the Component Style with the given Style |
protected Dimension calcPreferredSize() | Prevents scaling down of the menu when there is no text on the menu bar |
public void setTransitions(Transition transitionIn, Transition transitionOut) | Sets the menu transitions for showing/hiding the menu, can be null… |
public boolean isMenuShowing() | This method will return true if the menu dialog is currently displaying |
public void showMenu() | This method shows the menu on the Form. |
protected Button createBackCommandButton() | |
public void addCommand(Command cmd) | Adds a Command to the MenuBar |
public Command getCommand(int index) | Returns the command occupying the given index |
public int getCommandCount() | Returns number of commands |
protected void addCommand(Command cmd, int index) | Add a Command to the MenuBar |
protected void installMenuBar() | Adds the MenuBar on the parent Form |
protected void unInstallMenuBar() | Removes the MenuBar from the parent Form |
protected void removeAllCommands() | Remove all commands from the menuBar |
protected void removeCommand(Command cmd) | Removes a Command from the MenuBar |
protected Command createSelectCommand() | Factory method that returns the Form select Command. |
protected Command createMenuSelectCommand() | Factory method that returns the Form Menu select Command. |
protected Command createMenuCancelCommand() | Factory method that returns the Form Menu cancel Command. |
public void setMenuCellRenderer(ListCellRenderer menuCellRenderer) | The MenuBar default implementation shows the menu commands in a List contained in a Dialog. |
public Style getMenuStyle() | Returns the Menu Dialog Style |
public boolean handlesKeycode(int keyCode) | This method returns true if the MenuBar should handle the given keycode. |
public void keyPressed(int keyCode) | If this Component is focused, the key pressed event will call this method |
public void keyReleased(int keyCode) | If this Component is focused, the key released event will call this method |
public void refreshTheme(boolean merge) | Makes sure the component is up to date with the current theme, ONLY INVOKE THIS METHOD IF YOU CHANGED THE THEME! |
protected Command showMenuDialog(Dialog menu) | A menu is implemented as a dialog, this method allows you to override dialog display in order to customize the dialog menu in various ways |
protected boolean isReverseSoftButtons() | Allows an individual form to reverse the layout direction of the softbuttons, this method is RTL sensitive and might reverse the result based on RTL state |
protected int calculateTouchCommandGridColumns(Container grid) | Calculates the amount of columns to give to the touch commands within the grid |
public void setCommandUIID(Command cmd, String uiid) | Sets the command UIID to the given UIID, notice that this won’t work for all menu types since some menu types might be implemented natively or as a list in which case the UIID won’t apply! |
protected Button createTouchCommandButton(Command c) | Creates a touch command for use as a touch menu item |
protected Component createCommandComponent(Vector commands) | Creates the component containing the commands within the given vector used for showing the menu dialog, this method calls the createCommandList method by default however it allows more elaborate menu creation. |
protected Vector getCommands() | This method returns a Vector of Command objects |
protected List createCommandList(Vector commands) | Creates the list component containing the commands within the given vector used for showing the menu dialog |
protected Command getSelectMenuItem() | This method returns the select menu item, when a menu is opened |
protected Command getCancelMenuItem() | This method returns the cancel menu item, when a menu is opened |
public boolean isMinimizeOnBack() | When set to true the physical back button will minimize the application |
public void setMinimizeOnBack(boolean minimizeOnBack) | When set to true the physical back button will minimize the application |
protected int getDragRegionStatus(int x, int y) | Indicates if the section within the X/Y area is a “drag region” where we expect people to drag or press in which case we can instantly start dragging making perceived performance faster. |
protected Container getTitleAreaContainer() | Returns the parent Form title area |
protected Component getTitleComponent() | Gets the Form titleComponent |
Inherited fields
From Component
DEFAULT_CURSOR, CROSSHAIR_CURSOR, TEXT_CURSOR, WAIT_CURSOR, SW_RESIZE_CURSOR, SE_RESIZE_CURSOR, NW_RESIZE_CURSOR, NE_RESIZE_CURSOR, N_RESIZE_CURSOR, S_RESIZE_CURSOR, W_RESIZE_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_Y, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_IMMEDIATELY_DRAG_XY, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_CENTER_OFFSET, BRB_OTHER, CENTER, TOP, LEFT, BOTTOM, RIGHT, BASELINE
Inherited methods
From Container
encloseIn, encloseIn, initLaf, getUIManager, setUIManager, isSurface, add, addAll, add, add, add, add, add, getLeadComponent, setLeadComponent, getLeadParent, getLayout, setLayout, invalidate, setShouldLayout, setShouldCalcPreferredSize, getLayoutWidth, getLayoutHeight, applyRTL, constrainWidthWhenScrollable, constrainHeightWhenScrollable, addComponent, addComponent, addComponent, addComponent, replaceAndWait, replaceAndWait, replace, replaceAndWait, replace, createReplaceTransition, isEnabled, setEnabled, removeComponent, cancelRepaints, flushReplace, removeAll, revalidateWithAnimationSafety, revalidate, revalidateLater, forceRevalidate, clearClientProperties, paint, paintGlass, layoutContainer, isSafeArea, setSafeArea, isSafeAreaRoot, getSafeAreaRoot, setSafeAreaRoot, getComponentCount, getComponentAt, getComponentIndex, contains, scrollComponentToVisible, getClosestComponentTo, getResponderAt, getComponentAt, findDropTargetAt, pointerPressed, paramString, isScrollableX, setScrollableX, isScrollableY, setScrollableY, getSideGap, getBottomGap, setScrollable, setCellRenderer, getScrollIncrement, setScrollIncrement, findFirstFocusable, dragInitiated, fireClicked, isSelectableInteraction, getGridPosY, paintComponentBackground, getGridPosX, animateHierarchyAndWait, createAnimateHierarchy, animateHierarchy, animateHierarchyFadeAndWait, createAnimateHierarchyFade, animateHierarchyFade, animateLayoutFadeAndWait, createAnimateLayoutFadeAndWait, animateLayoutFade, createAnimateLayoutFade, animateLayoutAndWait, animateLayout, updateTabIndices, createAnimateLayout, drop, createAnimateMotion, morph, morphAndWait, animateUnlayout, animateUnlayoutAndWait, createAnimateUnlayout, getChildrenAsList, iterator, iterator
From Component
setSameSize, isSetCursorSupported, parsePreferredSize, getDefaultDragTransparency, setDefaultDragTransparency, getEditingDelegate, setEditingDelegate, getCursor, setCursor, showNativeOverlay, hideNativeOverlay, updateNativeOverlay, getNativeOverlay, getAllStyles, getSameWidth, setSameWidth, getSameHeight, setSameHeight, getX, setX, getOuterX, getInnerX, getY, setY, getOuterY, getInnerY, isVisible, setVisible, getClientProperty, stripMarginAndPadding, putClientProperty, getDirtyRegion, setDirtyRegion, isOpaque, setOpaque, getWidth, setWidth, getOuterWidth, getInnerWidth, getHeight, setHeight, getOuterHeight, getInnerHeight, isDragRegion, getBaseline, getBaselineResizeBehavior, getPreferredSizeStr, setPreferredSizeStr, getPreferredSize, setPreferredSize, getScrollDimension, calcScrollSize, setScrollSize, getPreferredW, setPreferredW, getPreferredH, setPreferredH, getOuterPreferredH, getInnerPreferredH, getOuterPreferredW, getInnerPreferredW, setSize, getUIID, setUIID, setUIIDFinal, setUIID, getInlineAllStyles, setInlineAllStyles, getInlineSelectedStyles, setInlineSelectedStyles, getInlineUnselectedStyles, setInlineUnselectedStyles, getInlineDisabledStyles, setInlineDisabledStyles, getInlinePressedStyles, setInlinePressedStyles, remove, getParent, getOwner, setOwner, isOwnedBy, containsOrOwns, addFocusListener, removeFocusListener, addScrollListener, removeScrollListener, getSelectCommandText, setSelectCommandText, getLabelForComponent, setLabelForComponent, focusGained, focusLost, paintBackgrounds, paintShadows, getAbsoluteX, getAbsoluteY, isInClippingRegion, paintIntersectingComponentsAbove, paintScrollbars, paintScrollbarX, getScrollOpacity, getSelectedRect, paintScrollbarY, paintComponent, paintComponent, getBorder, getScrollable, paintBackground, isScrollable, getScrollX, setScrollX, getScrollY, setScrollY, onScrollX, onScrollY, getDraggedx, getDraggedy, contains, visibleBoundsContains, hasFixedPreferredSize, getBounds, getBounds, getVisibleBounds, getVisibleBounds, isFocusable, setFocusable, onSetFocusable, resetFocusable, getTabIndex, setTabIndex, getPreferredTabIndex, setPreferredTabIndex, isTraversable, setTraversable, handlesInput, setHandlesInput, consumesRawTextInput, hasFocus, setFocus, getComponentForm, getTopLevelContainer, repaint, repaint, longKeyPress, keyRepeated, registerForAnimation, deregisterFromAnimation, getAnimationManager, getScrollAnimationSpeed, setScrollAnimationSpeed, isBlockLead, setBlockLead, isIgnorePointerEvents, setIgnorePointerEvents, isRippleEffect, setRippleEffect, getInlineStylesTheme, setInlineStylesTheme, shouldRenderComponentSelection, isHideInLandscape, setHideInLandscape, createStyleAnimation, isSmoothScrolling, setSmoothScrolling, pointerHover, stopScrollMomentum, pointerHoverReleased, pointerHoverPressed, pinch, pinchReleased, pinch, rotation, isPinchBlocksDragAndDrop, setPinchBlocksDragAndDrop, pointerDragged, getDragImage, getDragTransparency, setDragTransparency, toImage, drawDraggedImage, draggingOver, dragEnter, dragExit, addPullToRefresh, setPullToRefresh, respondsToPointerEvents, pointerDragged, isStickyDrag, pointerPressed, isDragAndDropOperation, pointerReleased, longPointerPress, pointerReleased, setVerticalScrollBounds, setHorizontalScrollBounds, isVScrollThumbGrabbed, isHScrollThumbGrabbed, isVScrollThumbHover, isHScrollThumbHover, isTensileDragEnabled, setTensileDragEnabled, getTextSelectionSupport, addDropListener, removeDropListener, addDragOverListener, removeDragOverListener, isNativeDragSource, setNativeDragSource, getNativeDragOperation, setNativeDragOperation, createNativeDragOperation, isNativeDropTarget, setNativeDropTarget, getAcceptedDropMimeTypes, setAcceptedDropMimeTypes, getAcceptedDropActions, setAcceptedDropActions, canAcceptNativeDrop, nativeDragEnter, nativeDragOver, nativeDragExit, nativeDrop, addNativeDropListener, removeNativeDropListener, addNativeDragOverListener, removeNativeDragOverListener, dragFinished, addDragFinishedListener, addStateChangeListener, removeStateChangeListener, addPointerPressedListener, addLongPressListener, addContextMenuListener, removeContextMenuListener, addMouseWheelListener, removeMouseWheelListener, addStylusListener, removeStylusListener, mouseWheel, paintRippleOverlay, removePointerPressedListener, removeLongPressListener, removeDragFinishedListener, addPointerReleasedListener, removePointerReleasedListener, addPointerDraggedListener, removePointerDraggedListener, getDragSpeed, getStyle, getPressedStyle, setPressedStyle, initUnselectedStyle, initPressedStyle, initDisabledStyle, initSelectedStyle, getUnselectedStyle, getSelectedStyle, setSelectedStyle, getDisabledStyle, setDisabledStyle, installDefaultPainter, requestFocus, toString, refreshTheme, refreshTheme, isDragActivated, animate, scrollRectToVisible, scrollRectToVisible, paintBorder, paintBorderBackground, isCellRenderer, isScrollVisible, setScrollVisible, setIsScrollVisible, startEditingAsync, stopEditing, isEditing, isEditable, laidOut, deinitialize, initComponent, isInitialized, setInitialized, styleChanged, getNextFocusDown, setNextFocusDown, getNextFocusUp, setNextFocusUp, getNextFocusLeft, setNextFocusLeft, getNextFocusRight, setNextFocusRight, getName, setName, initCustomStyle, deinitializeCustomStyle, isRTL, setRTL, isTactileTouch, isTactileTouch, setTactileTouch, getPropertyNames, getPropertyTypes, getPropertyTypeNames, getPropertyValue, setPropertyValue, paintLockRelease, paintLock, isSnapToGrid, setSnapToGrid, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, blocksSideSwipe, isFlatten, setFlatten, getTensileLength, setTensileLength, isGrabsPointerEvents, setGrabsPointerEvents, getScrollOpacityChangeSpeed, setScrollOpacityChangeSpeed, growShrink, isAlwaysTensile, setAlwaysTensile, isDraggable, setDraggable, isDropTarget, setDropTarget, isChildOf, isHideInPortrait, setHideInPortrait, getBindablePropertyNames, getBindablePropertyTypes, bindProperty, unbindProperty, getBoundPropertyValue, setBoundPropertyValue, getCloudBoundProperty, setCloudBoundProperty, getCloudDestinationProperty, setCloudDestinationProperty, getComponentState, setComponentState, setHidden, isHidden, setHidden, isHidden, announceForAccessibility, getAccessibilityText, setAccessibilityText, getSemantics, getAccessibilityNode, accessibilityChanged, accessibilityChanged, getTooltip, setTooltip
Constructor details
MenuBar
public MenuBar()Method details
initMenuBar
protected void initMenuBar(Form parent)Parameters
parentForm- the associated Form
removeEmptySoftbuttons
public void removeEmptySoftbuttons()getCommandBehavior
public int getCommandBehavior()getDefaultCommand
public Command getDefaultCommand()Returns
setDefaultCommand
public void setDefaultCommand(Command defaultCommand)Parameters
defaultCommandCommand- the command to treat as default
getClearCommand
public Command getClearCommand()Returns
setClearCommand
public void setClearCommand(Command clearCommand)Parameters
clearCommandCommand- the command to treat as the clear Command
findCommandComponent
public Button findCommandComponent(Command c)Parameters
cCommand- the command instance
Returns
getBackCommand
public Command getBackCommand()Returns
setBackCommand
public void setBackCommand(Command backCommand)Parameters
backCommandCommand- the command to treat as the back Command
getSelectCommand
public Command getSelectCommand()Returns
setSelectCommand
public void setSelectCommand(Command selectCommand)actionPerformed
public void actionPerformed(ActionEvent evt)Parameters
evtActionEvent- event object describing the source of the action as well as its trigger
createSoftButton
protected Button createSoftButton(String uiid)Returns
setUnselectedStyle
public void setUnselectedStyle(Style style)Parameters
styleStyle- the component Style object
calcPreferredSize
protected Dimension calcPreferredSize()Returns
setTransitions
public void setTransitions(Transition transitionIn, Transition transitionOut)isMenuShowing
public boolean isMenuShowing()Returns
showMenu
public void showMenu()createBackCommandButton
protected Button createBackCommandButton()addCommand
public void addCommand(Command cmd)Parameters
cmdCommand- Command to add
getCommand
public Command getCommand(int index)Parameters
indexint- offset of the command
Returns
getCommandCount
public int getCommandCount()Returns
addCommand
protected void addCommand(Command cmd, int index)Parameters
cmdCommand- Command to Add
indexint- determines the order of the added commands
installMenuBar
protected void installMenuBar()unInstallMenuBar
protected void unInstallMenuBar()removeAllCommands
protected void removeAllCommands()removeCommand
protected void removeCommand(Command cmd)Parameters
cmdCommand- Command to remove
createSelectCommand
protected Command createSelectCommand()Returns
createMenuSelectCommand
protected Command createMenuSelectCommand()Returns
createMenuCancelCommand
protected Command createMenuCancelCommand()Returns
setMenuCellRenderer
public void setMenuCellRenderer(ListCellRenderer menuCellRenderer)getMenuStyle
public Style getMenuStyle()Returns
handlesKeycode
public boolean handlesKeycode(int keyCode)Parameters
keyCodeint- to determine if the MenuBar is responsible for.
Returns
keyPressed
public void keyPressed(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
keyReleased
public void keyReleased(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
refreshTheme
public void refreshTheme(boolean merge)Parameters
mergeboolean- indicates if the current styles should be merged with the new styles
showMenuDialog
protected Command showMenuDialog(Dialog menu)Parameters
menuDialog- a dialog containing menu options that can be customized
Returns
isReverseSoftButtons
protected boolean isReverseSoftButtons()Returns
calculateTouchCommandGridColumns
protected int calculateTouchCommandGridColumns(Container grid)Parameters
gridContainer- container that will be arranged in the grid containing the components
Returns
setCommandUIID
public void setCommandUIID(Command cmd, String uiid)Parameters
cmdCommand- the command
uiidString- the uiid for the given command
createTouchCommandButton
protected Button createTouchCommandButton(Command c)Parameters
cCommand- command to map into the returned button
Returns
createCommandComponent
protected Component createCommandComponent(Vector commands)Parameters
commandsVector- list of command objects
Returns
getCommands
protected Vector getCommands()Returns
createCommandList
protected List createCommandList(Vector commands)Parameters
commandsVector- list of command objects
Returns
getSelectMenuItem
protected Command getSelectMenuItem()Returns
getCancelMenuItem
protected Command getCancelMenuItem()Returns
isMinimizeOnBack
public boolean isMinimizeOnBack()Returns
setMinimizeOnBack
public void setMinimizeOnBack(boolean minimizeOnBack)Parameters
minimizeOnBackboolean- the minimizeOnBack to set
getDragRegionStatus
protected int getDragRegionStatus(int x, int y)Parameters
xint- x location for the touch
yint- y location for the touch
Returns
getTitleAreaContainer
protected Container getTitleAreaContainer()Returns
getTitleComponent
protected Component getTitleComponent()