Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## waba.ui
Class PopupMenu

    java.lang.Object
      |
      +--waba.ui.Control
            |
            +--waba.ui.Container
                  |
                  +--waba.ui.Window
                        |
                        +--waba.ui.PopupMenu

public class PopupMenu
extends Window

Constructs a PopupMenu with the given items. This class is used in conjunction with the MenuBar. Although, you can also use it to create a stand alone "right click" menu.

It automatically saves and restores the covered area. Here is an example of how to build the popupmenu for the DateBook:

     String col1[] = // note that the first String is always skipped
     {
       "Record",
       "NewEvent",
       "Delete Note...",
       "Purge...",
       "-",           // create a dotted line
       "Beam Event",
     };
     PopupMenu pop = new PopupMenu(10,10,col1);
     popupModal(pop);
     // a WINDOW_CLOSED event is generated when a item is selected. The Window
     // is closed when the user clicks outside or selects an item. Use the getSelected
     // method to discover the index of the String array that was selected (-1 if none).

Note: the menu items must fit on screen. No clipping is applied. Also, the font and colors can be changed if desired.

Fields inherited from class waba.ui.Window
`beepIfOut, borderStyle, canDrag, eraseBackgroundNow, flicker, HIDE_STATE, highResPrepared, imgCovered, lastSwappedContainer, mainSwapContainer, menubar, needsPaint, NO_BORDER, RECT_BORDER, ROUND_BORDER, TAB_BORDER, TAB_ONLY_BORDER, title, titleFont, topMost, VK_BOTTOM, VK_HIDE, VK_TOP, zStack`

Fields inherited from class waba.ui.Container
`BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, lastH, lastW, lastX, lastY, parentWindow, tail`

Fields inherited from class waba.ui.Control
`AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2`

Constructor Summary
`PopupMenu(int x, int y, String[] items)` Create a MenuBar with the given items and that will be poped up at the given x,y coords.

Method Summary
`int` | `getSelected()` Returns the selected index when this window was closed or -1 if non was selected
`protected boolean` | `onClickedOutside(int x, int y)` Close the popup list with a click outside its bounds
`protected void` | `onColorsChanged(boolean colorsChanged)` Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.
`void` | `onEvent(Event event)` Called to process key, pen, control and other posted events.
`protected void` | `onFontChanged()` Change the font and recompute some parameters
`void` | `onPaint(Graphics g)` Draws the border (if any).
`protected void` | `onPopup()` Setup some important variables
`void` | `setCursorColor(Color c)` Sets the cursor color.

Methods inherited from class waba.ui.Window
`_doPaint, _doPaint, _postEvent, damageRect, destroyZStack, dontSaveBehind, getClientRect, getFocus, getOffScreen, getPreferredHeight, getPreferredWidth, getTopMost, isTopMost, isVisible, loadBehind, makeUnmovable, onUnpop, paintTitle, popupBlockingModal, popupMenuBar, popupModal, postPopup, postUnpop, pumpEvents, saveBehind, setBorderStyle, setDoubleBuffer, setFocus, setMenuBar, setStatePosition, setTitle, setTitleFont, swap, unpop`

Methods inherited from class waba.ui.Container
`add, add, add, broadcastEvent, findChild, getChildren, onStart, paintChildren, remove, setEnabled`

Methods inherited from class waba.ui.Control
`addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, onBoundsChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, toString, wait, wait`

Constructor Detail

### PopupMenu

    public PopupMenu(int x,
                     int y,
                     String[] items)

  Create a MenuBar with the given items and that will be poped up at the given x,y coords.

Method Detail

### onFontChanged

    protected void onFontChanged()

  Change the font and recompute some parameters
  Overrides:
    onFontChanged in class Control

### getSelected

    public int getSelected()

  Returns the selected index when this window was closed or -1 if non was selected

### onPopup

    protected void onPopup()

  Setup some important variables
  Overrides:
    onPopup in class Window

### onClickedOutside

    protected boolean onClickedOutside(int x,
                                       int y)

  Close the popup list with a click outside its bounds
  Overrides:
    onClickedOutside in class Window

### onEvent

    public void onEvent(Event event)

  Description copied from class: Control
  Called to process key, pen, control and other posted events.
  Overrides:
    onEvent in class Control
  Tags copied from class: Control
  Parameters:
    `event` - the event to process
  See Also:
    `Event`, `KeyEvent`, `PenEvent`

### setCursorColor

    public void setCursorColor(Color c)

  Sets the cursor color. By default, it is based in the background color

### onColorsChanged

    protected void onColorsChanged(boolean colorsChanged)

  Description copied from class: Control
  Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled
  Overrides:
    onColorsChanged in class Container

### onPaint

    public void onPaint(Graphics g)

  Description copied from class: Container
  Draws the border (if any). If you override this method, be sure to call `super.onPaint(g);`, or the border will not be drawn.
  Overrides:
    onPaint in class Container
  Tags copied from class: Control
  Parameters:
    `g` - the graphics object for drawing
  See Also:
    `Graphics`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD