jcontrol.ui.vole
Class List

java.lang.Object
  extended by jcontrol.ui.vole.Component
      extended by jcontrol.ui.vole.List

public class List
extends Component

The List component shows a list of text items with a vertical scroll bar on the right. List items can be added and removed by the application even when the list is already showing.

(c) Copyright 2003-2007 DOMOLOGIC GmbH


Field Summary
 
Fields inherited from class jcontrol.ui.vole.Component
eventQueue, focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
List()
          Create a new empty list without scroll bar.
List(int x, int y, boolean scrollbar)
          Create a new empty list at the given x- and y-coordinates.
List(int x, int y, int width, int height, boolean scrollbar)
          Create a new List with the specified items at the given x- and y-coordinates.
List(String[] items, int x, int y, int width, int height, boolean scrollbar)
          Create a new List with the specified list of items at the given x- and y-coordinates with the specified width and height.
 
Method Summary
 void add(String item)
          Adds an item to this ComboBox.
protected  void deSelect(int selItem)
          De-invert last selected item
protected  void drawItems()
          Draw currently visible items of the list.
 boolean onKeyEvent(KeyEvent e)
          Handle key events.
 void paint()
          Paint this List.
 void paintScrollbar()
          Paint the ScrollBar.
 boolean remove(String item)
          Removes the first occurrence of item from the ComboBox.
 void setActionListener(ActionListener listener)
          Sets an ActionListener for the ComboBox.
 void validate()
          Compute this component's preferred size and assign internal values width and height.
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, remove, removeFocus, requestFocus, setBounds, setFont, setGraphics, setParent, setVisible, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Constructor Detail

List

public List()
Create a new empty list without scroll bar.


List

public List(int x,
            int y,
            boolean scrollbar)
Create a new empty list at the given x- and y-coordinates. The preferred width and height is internally computed by taking the list items dimensions.

Parameters:
x - The x-coordinate of the List.
y - The y-coordinate of the List.
scrollbar - Select whether a scrollbar should be displayed.

List

public List(int x,
            int y,
            int width,
            int height,
            boolean scrollbar)
Create a new List with the specified items at the given x- and y-coordinates. The preferred width and height is internally computed by taking the contained items dimensions.

Parameters:
x - The x-coordinate of this List.
y - The y-coordinate of this List.
width - The width of this List.
height - The height of this List.
scrollbar - Select whether a scrollbar should be displayed.

List

public List(String[] items,
            int x,
            int y,
            int width,
            int height,
            boolean scrollbar)
Create a new List with the specified list of items at the given x- and y-coordinates with the specified width and height.

Parameters:
items - An array of text-items.
x - The x-coordinate of this List.
y - The y-coordinate of this List.
width - The width of this List.
height - The height of this List.
scrollbar - Select whether a scrollbar should be displayed.
Method Detail

add

public void add(String item)
Adds an item to this ComboBox.

Parameters:
item - The item to add to the ComboBox.

remove

public boolean remove(String item)
Removes the first occurrence of item from the ComboBox.

Parameters:
item - The item to remove from the ComboBox.
Returns:
Success of remove operation.

setActionListener

public void setActionListener(ActionListener listener)
Sets an ActionListener for the ComboBox. It will receive ActionEvents everytime a combo box item is pressed.

Parameters:
listener - The ActionListener to assign to this ComboBox.

onKeyEvent

public boolean onKeyEvent(KeyEvent e)
Handle key events. On several user actions, an ActionEvent is fired.

Overrides:
onKeyEvent in class Component
Parameters:
e - the KeyEvent
Returns:
If this method returns true, the KeyEvent is handled by the super Container.

paint

public void paint()
Paint this List.

Overrides:
paint in class Component

drawItems

protected void drawItems()
Draw currently visible items of the list.


deSelect

protected void deSelect(int selItem)
De-invert last selected item


validate

public void validate()
Compute this component's preferred size and assign internal values width and height.

Overrides:
validate in class Component

paintScrollbar

public void paintScrollbar()
Paint the ScrollBar.