    All Packages    This Package    Previous    Next

# Class awt.List

    java.lang.Object
       |
       +----awt.Component
               |
               +----awt.List

public class List
extends Component
implements ChoiceHandler

A scrolling list of text items.

Version:
  1.18 03 Feb 1995
Author:
  Sami Shaio

##

List(Container, ChoiceHandler, String, int, boolean, boolean)
  Creates a scrolling list.
List(Container, ChoiceHandler, String, int, boolean)

##

addItem(String)
  Adds an item to the scrolling list.
clear()
  Clears the list.
delItem(int)
  Deletes one item at the given position.
delItems(int, int)
  Deletes the items from start to end.
deselect(int)
  Deselect the given item.
dispose()
  Destructor (must be called to release resources).
doubleClick(Component, int)
  This is invoked when the user double-clicks on an item in the list.
getPreferredSize()
  Returns the natural size of the object.
isSelected(int)
  Return true if the given item has been selected.
itemAt(int)
  Gets the string associated with the given position.
makeVisible(int)
  Force the given position to be visible.
map()
  Maps the object (called automatically when the parent is mapped).
minDimension()
  Returns the minimum size of the object.
move(int, int)
  Moves the component to a new location.
nItems()
  Returns the number of items in the list.
reshape(int, int, int, int)
  Reshapes the component.
select(int)
  Select the given item.
selected(Component, int)
  This is the callback method for a ChoiceHandler interface.
setHFill(boolean)
  Sets whether or not this List stretches horizontally.
setNVisible(int)
  Set the number of visible lines.
setVFill(boolean)
  Sets whether or not this List stretches vertically.
unMap()
  UnMaps the object (called automatically when the parent is unmapped).

##

List

      public List(Container p,
                  ChoiceHandler ch,
                  String pName,
                  int visibleLines,
                  boolean multipleSelections,
                  boolean resizable)

  Creates a scrolling list.
  Parameters:
    p - is the parent window for this List.
    ch - is the object that will handle selections for this List.
    visibleLines - is the number of items to show.
    multipleSelections - if true then multiple selections are allowed.
    resizable - if true then the list will attempt to grow or shrink to match the width of the items it contains.

List

      public List(Container p,
                  ChoiceHandler ch,
                  String pName,
                  int visibleLines,
                  boolean multipleSelections)

##

selected

      public void selected(Component c,
                           int pos)

  This is the callback method for a ChoiceHandler interface. It will be called when the use single-clicks on an item in the scrolling list. If pos is -1 then this indicates multiple selections. Override to do something useful.

doubleClick

      public void doubleClick(Component c,
                              int pos)

  This is invoked when the user double-clicks on an item in the list. Override to do something useful.

isSelected

      public boolean isSelected(int pos)

  Return true if the given item has been selected.

addItem

      public void addItem(String item)

  Adds an item to the scrolling list.

itemAt

      public String itemAt(int pos)

  Gets the string associated with the given position.

clear

      public void clear()

  Clears the list.

setNVisible

      public void setNVisible(int nLines)

  Set the number of visible lines.

delItem

      public void delItem(int pos)

  Deletes one item at the given position.

delItems

      public void delItems(int start,
                           int end)

  Deletes the items from start to end.

setHFill

      public void setHFill(boolean t)

  Sets whether or not this List stretches horizontally.

setVFill

      public void setVFill(boolean t)

  Sets whether or not this List stretches vertically.

getPreferredSize

      public Dimension getPreferredSize()

  Returns the natural size of the object.
  Overrides:
    getPreferredSize in class Component

minDimension

      public Dimension minDimension()

  Returns the minimum size of the object.
  Overrides:
    minDimension in class Component

reshape

      public void reshape(int x,
                          int y,
                          int w,
                          int h)

  Reshapes the component.
  Overrides:
    reshape in class Component

move

      public void move(int X,
                       int Y)

  Moves the component to a new location.
  Overrides:
    move in class Component

select

      public void select(int pos)

  Select the given item.

deselect

      public void deselect(int pos)

  Deselect the given item.

makeVisible

      public void makeVisible(int pos)

  Force the given position to be visible.

nItems

      public int nItems()

  Returns the number of items in the list.

map

      public void map()

  Maps the object (called automatically when the parent is mapped).
  Overrides:
    map in class Component

unMap

      public void unMap()

  UnMaps the object (called automatically when the parent is unmapped).
  Overrides:
    unMap in class Component

dispose

      public void dispose()

  Destructor (must be called to release resources).
  Overrides:
    dispose in class Component

    All Packages    This Package    Previous    Next