marimba.gui
Class DropDownListBoxWidget

java.lang.Object
  |
  +--marimba.gui.Widget
        |
        +--marimba.gui.ChoiceWidget
              |
              +--marimba.gui.DropDownListBoxWidget
All Implemented Interfaces:
java.awt.image.ImageObserver, PropertyObject, TimerClient, WidgetConstants
Direct Known Subclasses:
DropDownComboBoxWidget, SmartDDListBoxWidget, SparseDropDownListBoxWidget

public class DropDownListBoxWidget
extends ChoiceWidget

A multiple choice widget.

Version:
1.57, 05/07/98
Author:
Klaas Waslander
See Also:
DropDownMenu

Field Summary
 int align
          The arrow button can be displayed at the left or the right.
protected static Options alignOptions
          The possible options for the alignment (LEFT or RIGHT).
 boolean fillButton
          If true, the dropdown button will be filled.
 boolean fixedWidth
          The menu can have a fixed width or adjust its width to the width of the menu items.
 int maxVisible
          The maximum number of visible items, if there are more items a scrollbar is used.
 int style
          A dropdownlistbox can be plain, boxed, filled or underlined.
protected static Options styleOptions
          The possible options for the style (PLAIN, BOXED, FILLED, UNDERLINE).
 DropDownTextBoxWidget text
          The textbox used for this dropdownlistbox.
 
Fields inherited from class marimba.gui.ChoiceWidget
choices, current, names, NOCHOICE
 
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
DropDownListBoxWidget()
          Constructor.
DropDownListBoxWidget(java.lang.String value, int style, int align, java.lang.String list)
          Constructor that actually does something.
 
Method Summary
 int getAlign()
          Get align.
static Options getAlignOptions()
          Get the possible options for the alignment.
 boolean getFillButton()
          Check whether the dropdown button is being filled.
 int getMaxVisible()
          Get the maximum number of visible items in the popup.
 java.awt.Dimension getPreferredSize()
          Get the preferred size of URL text widgets.
 void getProperties(PropertyList list)
          Get the properties of this widget.
 int getStyle()
          Get style.
static Options getStyleOptions()
          Get the possible options for the style.
 boolean handleEvent(java.awt.Event evt)
          Handle events.
 boolean hasFixedWidth()
          Check whether the menu has a fixed width.
 void layout()
          Lay out the container.
protected  DropDownMenu newDropDown()
          Display and return a new dropdownmenu with the required settings for letting it behave like the dropdownlistbox wants it to.
protected  DropDownTextBoxWidget newTextBox()
          Returns a new textbox with the necessary properties set to let it behave like the dropdownlist wants it to.
 void paint(java.awt.Graphics g)
          Refreshes text with key value.
 void selectNextItem()
          Select the next item, if there is no current item yet, it will result in the selection of the first item.
 void selectPreviousItem()
          Select previous item, if there is no current item yet, it will result in the selection of the last item.
 void setAlign(int align)
          Set align.
 void setDisabled(boolean disabled)
          Disable the textbox too, if there is one.
 void setFillButton(boolean fillButton)
          Fill the dropdown button or not.
 void setFixedWidth(boolean fixedWidth)
          Let the width be fixed or let it adjust to the menu item(s).
 void setMaxVisible(int maxVisible)
          Set the maximum number of visible items in the popup.
 void setProperties(PropertyList list)
          Set the properties of this widget.
 void setScrollbarColors(java.awt.Color foreground, java.awt.Color hilite, java.awt.Color background)
          Set the colors of the scrollbar(s) in the dropdown, if a color is null the default color of this listbox will be used
 void setStyle(int style)
          Set style.
 void setValue(int value)
          Set the current choice given the index.
 void stop()
          Stop.
 
Methods inherited from class marimba.gui.ChoiceWidget
addChoice, addUniqueChoice, clear, getChildProperties, getChoice, getChoiceCount, getChoiceID, getChoices, getChoicesString, getChoiceText, getChoiceValue, getIntegerValue, getName, getNames, getStringValue, getText, getValue, getValueIndex, hasChoice, insertChoiceAt, isEnabled, paramString, removeAllChoices, removeChoice, removeChoiceAt, setChoices, setChoices, setChoices, setChoices, setText, setValue, setValue
 
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, findWidget, firstFocus, focusInterest, getAudioClip, getAudioClipAt, getBackground, getBounds, getCancelButton, getCursor, getDefaultButton, getDescription, getEditor, getEncoding, getFocusColor, getFont, getFontMetrics, getForeground, getHilite, getImage, getKey, getKey, getKey, getLayoutMgr, getLocale, getLocation, getName, getParent, getPlayerFrame, getPlayerPanel, getPresentation, getSelBackground, getSelFocusColor, getSelForeground, getSize, getText, getTip, getTip, getTipFont, getValue, getWidget, getWidgetAt, getWidgetAt, getWidgetClass, getWidgetsAt, getWidgetsAt, getWidgetsAt, gotFocus, gotoPage, gotoPage, hasFocus, hide, imageUpdate, inheritFont, init, inside, inside, invalidate, isDisabled, isShowing, isTransparent, isVisible, keyDown, keyUp, list, list, locateWidget, locateWidgets, locateWidgets, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, overlap, paint, paintAll, postEvent, previousFocus, remove, remove, remove, removeAll, repaint, repaint, repaint, repaint, repaintParent, replace, replace, replace, requestFocus, resetCursor, reshape, reshape, resize, resize, rmove, rscroll, scroll, setAttach, setBackground, setBounds, setBounds, setCursor, setEditor, setEncoding, setFont, setForeground, setHilite, setLayoutMgr, setLocale, setLocation, setName, setSize, setSize, setText, setTip, setTipFont, setTransparent, setValue, setVisible, show, show, size, start, sync, tick, toBack, toBack, toFront, toFront, toString, update, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

alignOptions

protected static Options alignOptions
The possible options for the alignment (LEFT or RIGHT).
See Also:
getAlignOptions(), align

styleOptions

protected static Options styleOptions
The possible options for the style (PLAIN, BOXED, FILLED, UNDERLINE).
See Also:
getStyleOptions(), style

style

public int style
A dropdownlistbox can be plain, boxed, filled or underlined.
See Also:
getStyle(), setStyle(int), styleOptions

align

public int align
The arrow button can be displayed at the left or the right.
See Also:
getAlign(), setAlign(int), alignOptions

text

public DropDownTextBoxWidget text
The textbox used for this dropdownlistbox.
See Also:
newTextBox()

maxVisible

public int maxVisible
The maximum number of visible items, if there are more items a scrollbar is used. If this number is zero or smaller the max number of visible items is determined by the size of the menu.
See Also:
getMaxVisible(), setMaxVisible(int)

fillButton

public boolean fillButton
If true, the dropdown button will be filled.
See Also:
getFillButton(), setFillButton(boolean)

fixedWidth

public boolean fixedWidth
The menu can have a fixed width or adjust its width to the width of the menu items.
See Also:
hasFixedWidth(), setFixedWidth(boolean)
Constructor Detail

DropDownListBoxWidget

public DropDownListBoxWidget()
Constructor.

DropDownListBoxWidget

public DropDownListBoxWidget(java.lang.String value,
                             int style,
                             int align,
                             java.lang.String list)
Constructor that actually does something.
Parameters:
value - Currently displayed value.
style - Take care of some mundane matters of appearance.
align - Where to put the text. More matters of appearance.
list - Some values to show.
Method Detail

getProperties

public void getProperties(PropertyList list)
Get the properties of this widget.
Overrides:
getProperties in class ChoiceWidget
Following copied from class: marimba.gui.Widget
Parameters:
list - The list in which the current state needs to be saved.
See Also:
Widget.setProperties(PropertyList)

setProperties

public void setProperties(PropertyList list)
Set the properties of this widget.
Overrides:
setProperties in class ChoiceWidget
Following copied from class: marimba.gui.Widget
Parameters:
list - The list that contains the new widget state.
See Also:
Widget.getProperties(PropertyList)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Get the preferred size of URL text widgets.
Overrides:
getPreferredSize in class Widget

setScrollbarColors

public void setScrollbarColors(java.awt.Color foreground,
                               java.awt.Color hilite,
                               java.awt.Color background)
Set the colors of the scrollbar(s) in the dropdown, if a color is null the default color of this listbox will be used

getAlignOptions

public static Options getAlignOptions()
Get the possible options for the alignment.
See Also:
alignOptions

getStyleOptions

public static Options getStyleOptions()
Get the possible options for the style.
See Also:
styleOptions

selectNextItem

public void selectNextItem()
Select the next item, if there is no current item yet, it will result in the selection of the first item. This does not wrap around from bottom to top.
See Also:
ChoiceWidget.current

selectPreviousItem

public void selectPreviousItem()
Select previous item, if there is no current item yet, it will result in the selection of the last item. This does not wrap.
See Also:
ChoiceWidget.current

getAlign

public int getAlign()
Get align.
See Also:
align

setAlign

public void setAlign(int align)
Set align.
See Also:
align

getFillButton

public boolean getFillButton()
Check whether the dropdown button is being filled.
See Also:
fillButton

setFillButton

public void setFillButton(boolean fillButton)
Fill the dropdown button or not.
See Also:
fillButton

hasFixedWidth

public boolean hasFixedWidth()
Check whether the menu has a fixed width.
See Also:
fixedWidth

setFixedWidth

public void setFixedWidth(boolean fixedWidth)
Let the width be fixed or let it adjust to the menu item(s).
See Also:
fixedWidth

getMaxVisible

public int getMaxVisible()
Get the maximum number of visible items in the popup.
See Also:
maxVisible

setMaxVisible

public void setMaxVisible(int maxVisible)
Set the maximum number of visible items in the popup.
See Also:
maxVisible

getStyle

public int getStyle()
Get style.
See Also:
style

setStyle

public void setStyle(int style)
Set style.
See Also:
style

paint

public void paint(java.awt.Graphics g)
Refreshes text with key value.
Overrides:
paint in class Widget

setValue

public void setValue(int value)
Set the current choice given the index.
Overrides:
setValue in class ChoiceWidget
Following copied from class: marimba.gui.ChoiceWidget
See Also:
ChoiceWidget.current

newTextBox

protected DropDownTextBoxWidget newTextBox()
Returns a new textbox with the necessary properties set to let it behave like the dropdownlist wants it to.
See Also:
text

setDisabled

public void setDisabled(boolean disabled)
Disable the textbox too, if there is one.
Overrides:
setDisabled in class Widget
Following copied from class: marimba.gui.Widget
See Also:
Widget.isDisabled(), Widget.enable(), Widget.disable()

stop

public void stop()
Stop. Get rid of the menu (just in case).
Overrides:
stop in class Widget

layout

public void layout()
Lay out the container.
Overrides:
layout in class Widget

newDropDown

protected DropDownMenu newDropDown()
Display and return a new dropdownmenu with the required settings for letting it behave like the dropdownlistbox wants it to.

handleEvent

public boolean handleEvent(java.awt.Event evt)
Handle events.
Overrides:
handleEvent in class Widget
Following copied from class: marimba.gui.Widget
Parameters:
evt - the event that needs to be handled by the widget
See Also:
Widget.postEvent(java.awt.Event)