marimba.gui
Class DropDownMenu

java.lang.Object
  |
  +--marimba.gui.Widget
        |
        +--marimba.gui.ContainerWidget
              |
              +--marimba.gui.GroupWidget
                    |
                    +--marimba.gui.PopupWidget
                          |
                          +--marimba.gui.PopupMenu
                                |
                                +--marimba.gui.DropDownMenu
All Implemented Interfaces:
java.awt.image.ImageObserver, PropertyObject, TimerClient, WidgetConstants
Direct Known Subclasses:
SparseDropDownMenu

public class DropDownMenu
extends PopupMenu

A simple drop down menu, that is automatically popped up if the choices are given to the constructor. It automatically positions itself correctly based on the parameters that were passed to the constructor.

Version:
1.37, 07/15/97
Author:
Klaas Waslander

Field Summary
 boolean autoSize
          Determines whether the width of the user should be used when popping up this dropdown menu.
 Widget user
          The widget that uses this DropDownMenu.
DropDownMenu sets the current value of the user and invokes the user.action() method when a choice is being made out of the available choices of this DropDownMenu.
The value is being set using user.setValue(new Integer(int)) where "int" is the index of the choice that was made.
 
Fields inherited from class marimba.gui.PopupMenu
container, current, dragged, itemFocus, maxVisible, mouseUpPopDown, owner, poppingDown, scrollJump, ticking
 
Fields inherited from class marimba.gui.PopupWidget
player
 
Fields inherited from class marimba.gui.GroupWidget
editing, fillMode, fillOptions, lineMode, lineOptions, patsrc, pattern, prevtx, prevty
 
Fields inherited from class marimba.gui.ContainerWidget
content
 
Fields inherited from class marimba.gui.Widget
adapter, background, clazz, defaultBackground, defaultFont, defaultForeground, defaultHilite, directGraphics, disabled, east, editor, focus, font, foreground, height, hilite, layoutMgr, name, north, nwidgets, parent, script, south, tip, transparent, tx, ty, valid, visible, wBackground, west, wFont, wForeground, wHilite, widgets, width, wScript, wTip, x, y
 
Fields inherited from interface marimba.gui.WidgetConstants
ALWAYS, ANYWHERE, APPLET, ASCENDING, BLINK, BLUE, BONGO_EVENT, BOTH, BOTTOM, BOXED, BUTTON, CENTER, CHAR, CHECK, COLLAPSE_EVENT, CONTENT, DESCENDING, DETACHED, DIAGONAL, DOWN, DRAG, EXCLUSIVE, EXPAND_EVENT, FILL, FILLED, GREEN, HORIZONTAL, INSIDE, INVISIBLE, JAVA_VERSION, JAVAOS, JDK10, JDK11, LAYERS, LEFT, LOWERED, MAC, MULTIPLE, NETCASTER, NETSCAPE, NEVER, NONE, NT, OPTIONAL, OS_ARCH, OS_NAME, OS_VERSION, OUTLINE, PAGE_DOWN, PAGE_EVENT, PAGE_UP, PATTERN, PC, PICTURE, PLAIN, PROPORTIONAL, RADIO, RAISED, RED, REST_EVENT, RIGHT, ROUNDED, SCALE, SCROLLBAR, SCROLLING, SOLID, SQUARE, TEXT_CHANGED_EVENT, TOP, TOPLEFT, TRUNCATE, UNDERLINE, UNIX, UP, VERTICAL, WAKE_EVENT, WIN95, WINDOWS, WORD
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DropDownMenu(Widget user, boolean autoSize)
          Constructor that sets the user and whether to autoSize, the max.
DropDownMenu(Widget user, boolean autoSize, int maxVisible)
          Constructor that sets the user, whether to autoSize and the max.
DropDownMenu(Widget user, java.lang.String[] choices, boolean autoSize)
          Constructor without setting the max number of visible items, the dropdown is popped up automatically!
DropDownMenu(Widget user, java.lang.String[] choices, boolean autoSize, int maxVisible)
          Constructor: Show a dropDownMenu that belongs to the given widget.
The items that should be in this menu are passed in the parameter called "choices", the dropdown is popped up automatically!
 
Method Summary
 void fit()
          When fitting this dropdown menu make sure it is properly positioned, it can also be above the user! That initial position is determined by the constructor of this class, this method just makes sure it fits on the screen.
 boolean handleEvent(java.awt.Event evt)
          Handle mouse events: the owner receives all mouse drag and mouse up events from this dropdown menu, the user's value is set when an action event occurs by passing its setValue method an Integer object that is the index of the menu item.
 void popup()
          The popup method that automatically determines where it should position itself, based on the parameters that were passed into the constructor.
 void selectNextItem()
          Select next item, do not loop around when the last item has been reached.
 void selectPreviousItem()
          Select previous item, do not loop around when the first item has been reached.
 
Methods inherited from class marimba.gui.PopupMenu
add, add, addSeparator, addSeparator, clear, focusInterest, getCurrentItem, getItem, getItemCount, getItemFocus, getMaxVisible, getOwner, getPopupHeight, getPreferredSize, indexOf, insert, insert, layout, layoutContainer, nextItem, paint, popdown, popup, popup, preferredSize, previousItem, remove, remove, remove, select, select, selectNextItem, selectPreviousItem, setItemFocus, setMaxVisible, setMouseUpPopDown, setOwner, tick
 
Methods inherited from class marimba.gui.PopupWidget
getPlayerPanel, isShowing, paramString, popup, postEvent, repaint, repaint, repaintParent, replace
 
Methods inherited from class marimba.gui.GroupWidget
getEditing, getEditor, getFillMode, getFillOptions, getLineMode, getLineOptions, getPattern, getPatternSource, getProperties, init, setEditing, setFillMode, setLineMode, setPattern, setProperties, update, updateArea, waitForPattern
 
Methods inherited from class marimba.gui.ContainerWidget
findInFocus, findWidget, firstInFocus, getChildProperties, getContent, newContent, nextInFocus, previousInFocus
 
Methods inherited from class marimba.gui.Widget
action, action, add, add, adjustFont, adjustFont, applyProperties, audioLoop, audioLoop, audioPlay, audioPlay, audioStop, audioStop, bounds, clearFocus, clearPopups, clone, contains, contains, createImage, createImage, currentFocus, destroy, disable, disable, enable, firstFocus, getAudioClip, getAudioClipAt, getBackground, getBounds, getCancelButton, getCursor, getDefaultButton, getDescription, getEncoding, getFocusColor, getFont, getFontMetrics, getForeground, getHilite, getImage, getKey, getKey, getKey, getLayoutMgr, getLocale, getLocation, getName, getParent, getPlayerFrame, getPresentation, getSelBackground, getSelFocusColor, getSelForeground, getSize, getText, getText, getTip, getTip, getTipFont, getValue, getValue, getWidget, getWidgetAt, getWidgetAt, getWidgetClass, getWidgetsAt, getWidgetsAt, getWidgetsAt, gotFocus, gotoPage, gotoPage, hasFocus, hide, imageUpdate, inheritFont, inside, inside, invalidate, isDisabled, isTransparent, isVisible, keyDown, keyUp, list, list, locateWidget, locateWidgets, locateWidgets, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, overlap, paint, paintAll, previousFocus, remove, remove, remove, removeAll, repaint, repaint, repaint, replace, replace, requestFocus, resetCursor, reshape, reshape, resize, resize, rmove, rscroll, scroll, setAttach, setBackground, setBounds, setBounds, setCursor, setDisabled, setEditor, setEncoding, setFont, setForeground, setHilite, setLayoutMgr, setLocale, setLocation, setName, setSize, setSize, setText, setText, setTip, setTipFont, setTransparent, setValue, setValue, setVisible, show, show, size, start, stop, sync, toBack, toBack, toFront, toFront, toString, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

user

public Widget user
The widget that uses this DropDownMenu.
DropDownMenu sets the current value of the user and invokes the user.action() method when a choice is being made out of the available choices of this DropDownMenu.
The value is being set using user.setValue(new Integer(int)) where "int" is the index of the choice that was made.

autoSize

public boolean autoSize
Determines whether the width of the user should be used when popping up this dropdown menu.
Constructor Detail

DropDownMenu

public DropDownMenu(Widget user,
                    boolean autoSize)
Constructor that sets the user and whether to autoSize, the max. number of visible items is not set; the dropdown is not automatically popped up! Do that using the popup() method, after you added the necessary menu items.
See Also:
popup(), PopupMenu.add(String), PopupMenu.add(PopupMenuItemWidget)

DropDownMenu

public DropDownMenu(Widget user,
                    boolean autoSize,
                    int maxVisible)
Constructor that sets the user, whether to autoSize and the max. number of visible items; the dropdown is not automatically popped up! Do that using the popup() method, after you added the necessary menu items.
See Also:
popup(), PopupMenu.add(String), PopupMenu.add(PopupMenuItemWidget)

DropDownMenu

public DropDownMenu(Widget user,
                    java.lang.String[] choices,
                    boolean autoSize)
Constructor without setting the max number of visible items, the dropdown is popped up automatically!
Parameters:
autoSize - if false, the width of the choicewidget is used.

DropDownMenu

public DropDownMenu(Widget user,
                    java.lang.String[] choices,
                    boolean autoSize,
                    int maxVisible)
Constructor: Show a dropDownMenu that belongs to the given widget.
The items that should be in this menu are passed in the parameter called "choices", the dropdown is popped up automatically!
Parameters:
autoSize - if false, the width of the choicewidget is used.
Method Detail

popup

public void popup()
The popup method that automatically determines where it should position itself, based on the parameters that were passed into the constructor. So calling one of the other popup methods here does not really make sense, since then you might as well have used the popupmenu.

fit

public void fit()
When fitting this dropdown menu make sure it is properly positioned, it can also be above the user! That initial position is determined by the constructor of this class, this method just makes sure it fits on the screen.
Overrides:
fit in class PopupMenu

selectNextItem

public void selectNextItem()
Select next item, do not loop around when the last item has been reached.
Overrides:
selectNextItem in class PopupMenu
See Also:
PopupMenu.current

selectPreviousItem

public void selectPreviousItem()
Select previous item, do not loop around when the first item has been reached.
Overrides:
selectPreviousItem in class PopupMenu
See Also:
PopupMenu.current

handleEvent

public boolean handleEvent(java.awt.Event evt)
Handle mouse events: the owner receives all mouse drag and mouse up events from this dropdown menu, the user's value is set when an action event occurs by passing its setValue method an Integer object that is the index of the menu item.
Overrides:
handleEvent in class PopupMenu
See Also:
user, PopupMenu.owner