All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.ImageListBox
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----symantec.itools.awt.ImageListBox
- public class ImageListBox
- extends Panel
A box containing a list of images and/or text.
Use an ImageListBox to display a set of images and/or text that the user
can select.
The user cannot enter text in an ImageListBox.
-
BORDER_NONE
- Defines the "no border" style.
-
BORDER_REGULAR
- Defines the "regular" (lowered) border style.
-
borderWidth
- Width of the left and right borders combined, in pixels.
-
cellHt
- Height of a single list cell, in pixels.
-
EVT_IMAGE_SELECT
- The ID of the event posted when the image portion of a list item
is selected.
-
halfBorderWidth
- Width of the left or right border, in pixels.
-
IMAGE_WIDTH
- Defines the width of all images displayed in the list, in pixels.
-
lWidth
- Width of the list content portion of this component, in pixels.
-
nTopRow
- Zero-relative index of the item displayed in the top row.
-
yAdj
- Top margin before the contents of the first list item, in pixels.
-
ImageListBox()
- Constructs a default ImageListBox.
-
ImageListBox(Component, String)
- Construct an ImageListBox with a specific parent component and the
specified label.
-
ImageListBox(Component, String, int, boolean)
- Constructs an ImageListBox.
-
ImageListBox(String)
- Constructs an ImageListBox with the specified label.
-
ImageListBox(String, boolean)
- Constructs an ImageListBox with the specified label and
conditionally allow multiple selections.
-
ImageListBox(String, int, boolean)
- Constructs an ImageListBox with the specified label, the
specified number of visible rows, and conditionally allow multiple
list item selection.
-
addItem(Image, String)
- Adds an item with an image to the end of the list and enables
it.
-
addItem(Image, String, boolean)
- Adds an item with an image to the end of the list and
conditionally enables it.
-
addItem(Image, String, boolean, Color)
- Adds an item with an image to the end of the list and
conditionally enables it.
-
addItem(String)
- Adds an item to the end of the list and enables the item.
-
addItem(String, boolean)
- Adds an item to the end of the list and conditionally enables
it.
-
addNotify()
- Tells this component that it has been added to a container.
-
allowsMultipleSelections()
- Returns true if this list allows multiple selections.
-
allSelected()
- Query if all of the rows are selected.
-
blockPaint(boolean)
- Blocks the repainting of the control.
-
changeImage(int, Image)
- Changes the image associated with the item at the specified
zero-relative index.
-
changeText(int, String)
- Changes the text associated with the item at the specified
zero-relative index.
-
clear()
- Deletes all items and images from the list.
-
countItems()
- Returns the total number of items in the list.
-
ctrlSelect(int)
- Selects an index in a ImageListBox using the Ctrl modifier
to mimic mouse selecting with the Ctrl modifier.
-
delItem(int)
- Deletes the specified item from the list.
-
delItems(int, int)
- Deletes multiple items from the list.
-
delSelectedItems()
- Deletes the currently selected items from the list.
-
deselect(int)
- Deselects the item at the specified index.
-
deselectAll()
- Deselects all items in the list.
-
disable(int)
- Disables the specified item in the list.
-
enable(int)
- Enables the specified item in the list.
-
enable(int, boolean)
- Conditionally enables the specified item in the list.
-
extraPaint(Graphics, Rectangle)
- Override this method to add any special painting effects after text and images are painted
-
getBorderType()
- Gets the current border type of the ImageListBox.
-
getCellBorders()
- Gets the current default cell border display mode.
-
getComboMode()
- Gets the current "ComboBox mode" setting.
-
getDefaultEnabledTextColor()
- Returns the current color for enabled text items.
-
getDisabledTextColor()
- Returns the current default color for disabled text items.
-
getEdited(int)
- Gets the "edited" flag state for the item at the given
zero-relative index.
-
getImage(int)
- Gets the image associated with the item at the specified zero-relative index.
-
getItem(int)
- Gets the item associated with the specified zero-relative index.
-
getLabel()
- Returns the current list box label.
-
getListBoxFont()
- Returns the font used for the list box items.
-
getListItems()
- Returns the current list as a array.
-
getRows()
- Returns the number of currently visible lines in this list.
-
getRowsToShow()
- Gets the current number of rows to display.
-
getSelectedIndex()
- Gets the zero-relative index of the selected item in the list.
-
getSelectedIndexes()
- Returns the indexes of all the selected items in the list.
-
getSelectedItem()
- Returns the currently selected item in the list.
-
getSelectedItems()
- Returns all of the the selected items in the list.
-
getShowHorizontalScroll()
- Gets the current horizontal scrollbar visibility flag.
-
getShowVerticalScroll()
- Gets the current vertical scrollbar visibility flag.
-
getVisibleIndex()
- Gets the index of the item that was last made visible by
the method makeVisible.
-
handleEvent(Event)
- Processes events for this component.
-
insertItem(int, Image, String, boolean)
- Inserts an item with an image at a specific zero-relative index and
conditionally enables it.
-
insertItems(int, Vector, Image, boolean)
- Inserts a vector list of items at a specific zero-relative index and
conditionally enables them.
-
isEnabled(int)
- Gets the enabled state of a specific item in the list.
-
isSelected(int)
- Gets the selected state of the item at the given index.
-
isVisibleIndex(int)
- Determines if the item at the given index is visible.
-
makeVisible(int)
- Scrolls the list as needed to ensure that the specified item is visible.
-
minimumSize()
- Returns the minimum dimensions to properly display this component.
-
minimumSize(int)
- Returns the minimum dimensions needed to show the given number of rows
in the list.
-
mouseCalcIndex(int)
- A utility routine that determines the index of the item the mouse is in,
given the vertical coordinate of the mouse.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
paramString()
- Returns a string representing the state of this object.
-
preferredSize()
- Returns the recommended dimensions to properly display this component.
-
preferredSize(int)
- Returns the preferred dimensions needed for the list with
the specified number of rows.
-
reshape(int, int, int, int)
- Moves and/or resizes this component.
-
scrollHorizontal(int, boolean)
- Scrolls the ImageListBox horizontally
-
scrollVertical(int, boolean)
- Scrolls the ImageListBox vertically.
-
select(int)
- Selects the item at the specified index.
-
select(String)
- Selects the first item in the list which has exactly
matching text.
-
selectAll()
- Selects all the items in the list.
-
selectMultiple(int, boolean, boolean)
- Selects an item at the specified index in a multiple-selection-enabled ImageListBox
using Shift, Ctrl or Ctrl-Shift modifiers to mimic mouse
selecting with the Shift, Ctrl or Ctrl-Shift modifiers.
-
setBorderType(int)
- Sets the border type of the ImageListBox.
-
setCellBorder(int, boolean)
- Conditionally show a border around the cell at the specified index.
-
setCellBorders(boolean)
- Sets the ImageListBox cell border display default, and
resets all items to have the border conditionally.
-
setColumns(int)
- Sets the number of columns to be used by minimumSize().
-
setComboMode(boolean)
- Sets ImageListBox "ComboBox mode".
-
setDefaultEnabledTextColor(Color)
- Sets the default color for enabled text items.
-
setDirectNotify(boolean)
- The ImageListBox posts LIST_SELECT and ACTION_EVENT events
directly to a specific parent if one is specified.
-
setDirty()
- Set the list to be "dirty" to force a complete
paint on next repaint.
-
setDisabledTextColor(Color)
- Sets the default color for disabled text items.
-
setEdited(int, boolean)
- Sets a flag indicating that the item at the given zero-relative index
has been edited.
-
setEnabledTextColor(int, Color)
- Sets the text color for an item at the given index.
-
setFont(Font)
- Sets this component's text font.
-
setListBoxFont(Font)
- Sets the font for the items in the list box.
-
setListItems(String[])
- Initializes the list with the string array.
-
setMultiColumnMode(boolean)
- Sets the mode of the ImageListBox to "MultiColumnListBox
mode".
-
setMultipleSelections(boolean)
- Sets whether this list should allow multiple selections
or not.
-
setRowsToShow(int)
- Sets the number of rows to display in the ImageListBox.
-
setShowHorizontalScroll(boolean)
- Sets the horizontal scrollbar visibility flag.
-
setShowVerticalScroll(boolean)
- Sets the vertical scrollbar visibility flag.
-
setTopRow(int)
- Forces the item at the specified index to be visible at
the top of the window.
-
shiftSelect(int, boolean)
- Selects an index in a multiple-selection-enabled ImageListBox
using Shift or Ctrl-Shift modifiers to mimic mouse
selecting with the Shift or Ctrl-Shift modifiers.
-
show()
- Makes this component visible.
-
update(Graphics)
- Handles redrawing of this component on the screen.
-
validIndex(int)
- Determines if the given index is valid.
EVT_IMAGE_SELECT
public final static int EVT_IMAGE_SELECT
- The ID of the event posted when the image portion of a list item
is selected.
BORDER_REGULAR
public final static int BORDER_REGULAR
- Defines the "regular" (lowered) border style. This makes the list box
appear lower than the surrounding area.
- See Also:
- setBorderType, getBorderType
BORDER_NONE
public final static int BORDER_NONE
- Defines the "no border" style. This indicates the list box will have no
border drawn around it.
- See Also:
- setBorderType, getBorderType
IMAGE_WIDTH
public final static int IMAGE_WIDTH
- Defines the width of all images displayed in the list, in pixels.
nTopRow
protected int nTopRow
- Zero-relative index of the item displayed in the top row.
lWidth
protected int lWidth
- Width of the list content portion of this component, in pixels.
This excludes the border and vertical scroll bar, if present.
cellHt
protected int cellHt
- Height of a single list cell, in pixels.
yAdj
protected int yAdj
- Top margin before the contents of the first list item, in pixels.
borderWidth
protected int borderWidth
- Width of the left and right borders combined, in pixels.
halfBorderWidth
protected int halfBorderWidth
- Width of the left or right border, in pixels.
ImageListBox
public ImageListBox()
- Constructs a default ImageListBox.
A default ImageListBox has no label, will size to show all of the
existing list items when automatically laid out, and allows single list
item selection.
ImageListBox
public ImageListBox(String label)
- Constructs an ImageListBox with the specified label. It will size to show
all of the existing list items when automatically laid out, and allows
single list item selection.
Note: he label of an ImageListBox does not get displayed.
- Parameters:
- label - the label of the list box (not displayed)
ImageListBox
public ImageListBox(String label,
boolean bMultipleSelections)
- Constructs an ImageListBox with the specified label and
conditionally allow multiple selections.
It will size to show all of the existing list items when
automatically laid out.
Note: the label of an ImageListBox does not get displayed.
- Parameters:
- label - the name label of the list box (not displayed)
- bMultipleSelections - if true then multiple selections are allowed;
if false only single item selections are allowed
ImageListBox
public ImageListBox(String label,
int rows,
boolean bMultipleSelections)
- Constructs an ImageListBox with the specified label, the
specified number of visible rows, and conditionally allow multiple
list item selection.
- Parameters:
- label - the label of the list box (not displayed)
- rows - the number of row items to show. If rows is less than or equal
to zero,
it will size to show all of the existing list items when
automatically laid out.
- bMultipleSelections - if true then multiple selections are allowed;
if false only single item selections are allowed
ImageListBox
public ImageListBox(Component parent,
String label)
- Construct an ImageListBox with a specific parent component and the
specified label.
It will size to show all of the existing list items when
automatically laid out.
- Parameters:
- parent - the parent of the list box, where all events are sent
- label - the label of the list box (not displayed)
ImageListBox
public ImageListBox(Component parent,
String slabel,
int rows,
boolean bMultipleSelections)
- Constructs an ImageListBox.
The created ImageListBox will have a specific parent component,
the specified label, show a specified number of rows and
conditionally allow multiple list item selection.
If the specified parent is null, the
parent (for event passing purposes) will be determined at event time.
- Parameters:
- parent - the parent of the list box, where all events should be sent
- slabel - the label of the list box (not displayed)
- rows - the number of items to show. If rows is less then or equal
to zero,
it will size to show all of the existing list items when
automatically laid out.
- bMultipleSelections - if true then multiple selections are allowed;
if false only single item selections are allowed
setComboMode
public void setComboMode(boolean cond)
- Sets ImageListBox "ComboBox mode".
"ComboBox mode" allows the selection point to follow
the mouse even when the mouse button is not down.
This only applies when the ImageListBox is not allowing multiple
selections.
- Parameters:
- cond - true for "ComboBox mode", false for normal list box mode.
- See Also:
- getComboMode
getComboMode
public boolean getComboMode()
- Gets the current "ComboBox mode" setting.
"ComboBox mode" allows the selection point to follow
the mouse even when the mouse button is not down.
This only applies when the ImageListBox is not allowing multiple
selections.
- Returns:
- true if in "ComboBox mode", otherwise false
- See Also:
- setComboMode
setRowsToShow
public void setRowsToShow(int rows)
- Sets the number of rows to display in the ImageListBox.
This affects the dimensions returned by getPreferredSize and determines
the number of rows displayed when this component is automatically laid out.
- Parameters:
- rows - number of rows to automatically display
- See Also:
- getRowsToShow
getRowsToShow
public int getRowsToShow()
- Gets the current number of rows to display.
This affects the dimensions returned by getPreferredSize and determines
the number of rows displayed when this component is automatically laid out.
- Returns:
- the current number of rows to automatically display
- See Also:
- setRowsToShow
setShowVerticalScroll
public void setShowVerticalScroll(boolean cond)
- Sets the vertical scrollbar visibility flag.
- Parameters:
- cond - if true, the vertical scrollbar will be made
visible when necessary; if false, the vertical scrollbar
will never be made visible
- See Also:
- getShowVerticalScroll
getShowVerticalScroll
public boolean getShowVerticalScroll()
- Gets the current vertical scrollbar visibility flag.
- Returns:
- s true if the vertical scrollbar will be made
visible when necessary; false if the vertical scrollbar
will never be made visible
- See Also:
- setShowVerticalScroll
setShowHorizontalScroll
public void setShowHorizontalScroll(boolean cond)
- Sets the horizontal scrollbar visibility flag.
- Parameters:
- cond - if true, the horizontal scrollbar will be made
visible when necessary; if false, the horizontal scrollbar
will never be made visible
- See Also:
- getShowHorizontalScroll
getShowHorizontalScroll
public boolean getShowHorizontalScroll()
- Gets the current horizontal scrollbar visibility flag.
- Returns:
- s true if the horizontal scrollbar will be made
visible when necessary; false if the horizontal scrollbar
will never be made visible
- See Also:
- setShowHorizontalScroll
setBorderType
public void setBorderType(int type)
- Sets the border type of the ImageListBox.
A regular border makes the list box appear lower than the surrounding area.
- Parameters:
- type - new border type, BORDER_REGULAR or BORDER_NONE
- See Also:
- getBorderType, BORDER_REGULAR, BORDER_NONE
getBorderType
public int getBorderType()
- Gets the current border type of the ImageListBox.
A regular border makes the list box appear lower than the surrounding area.
- Returns:
- the current border type, BORDER_REGULAR or BORDER_NONE
- See Also:
- setBorderType, BORDER_REGULAR, BORDER_NONE
setCellBorder
public void setCellBorder(int index,
boolean bOn)
- Conditionally show a border around the cell at the specified index.
Cell borders are always shown as a solid single-pixel wide line around
the cell.
- Parameters:
- index - the zero-relative index of the cell
- bOn - true to show the cell borders; false to not show them
- See Also:
- setCellBorders
setCellBorders
public void setCellBorders(boolean bOn)
- Sets the ImageListBox cell border display default, and
resets all items to have the border conditionally.
Cell borders are always shown as a solid single-pixel wide line around
the cell.
- Parameters:
- bOn - true for "grid lines on by default" mode,
false for "grid lines off by default" mode.
- See Also:
- setCellBorder, getCellBorders
getCellBorders
public boolean getCellBorders()
- Gets the current default cell border display mode.
Cell borders are always shown as a solid single-pixel wide line around
the cell.
- Returns:
- true if the "grid lines on by default" mode is on, otherwise false
- See Also:
- setCellBorders
setDefaultEnabledTextColor
public void setDefaultEnabledTextColor(Color color)
- Sets the default color for enabled text items.
- Parameters:
- color - the new default text color
- See Also:
- setEnabledTextColor, getDefaultEnabledTextColor
getDefaultEnabledTextColor
public Color getDefaultEnabledTextColor()
- Returns the current color for enabled text items.
- See Also:
- setDefaultEnabledTextColor
setDisabledTextColor
public void setDisabledTextColor(Color color)
- Sets the default color for disabled text items.
- Parameters:
- color - the new default disabled text color
- See Also:
- getDisabledTextColor
getDisabledTextColor
public Color getDisabledTextColor()
- Returns the current default color for disabled text items.
- Returns:
- the current default disabled text color
- See Also:
- setDisabledTextColor
setEnabledTextColor
public void setEnabledTextColor(int index,
Color color)
- Sets the text color for an item at the given index.
- Parameters:
- index - the zero-relative index of the item
- color - the color, null to use the default text color
handleEvent
public boolean handleEvent(Event evt)
- Processes events for this component.
This is a standard Java AWT method which gets called by the AWT
to handle this component's events. The default handler for
components dispatches to one of the following methods as needed:
action(), gotFocus(), lostFocus(), keyDown(), keyUp(), mouseEnter(),
mouseExit(), mouseMove(), mouseDrag(), mouseDown(), or mouseUp().
It is overridden here to handle scrolling and selection using the mouse
or keyboard.
- Parameters:
- evt - the event to handle
- Returns:
- true if the event was handled and no further action is needed,
false to pass the event to this component's parent
- Overrides:
- handleEvent in class Component
- See Also:
- action, gotFocus, lostFocus, keyDown, keyUp, mouseEnter, mouseExit, mouseMove, mouseDrag, mouseDown, mouseUp
setMultiColumnMode
public synchronized void setMultiColumnMode(boolean bCellBorders)
- Sets the mode of the ImageListBox to "MultiColumnListBox
mode". This method always sets the border type to BORDER_NONE,
the "ComboBox mode" to be false,
and conditionally sets whether the grid should be displayed.
- Parameters:
- bCellBorders - true to display the cell grid,
false to not display the grid
- See Also:
- BORDER_NONE
addItem
public synchronized void addItem(String item)
- Adds an item to the end of the list and enables the item.
- Parameters:
- item - the item to be added
- See Also:
- setListItems, addItem, addItem, addItem, addItem
setListItems
public void setListItems(String items[])
- Initializes the list with the string array. Any pre-existing items are
lost.
- Parameters:
- items - the new list items
- See Also:
- getListItems, setListItems, addItem, addItem, addItem, addItem, addItem
getListItems
public String[] getListItems()
- Returns the current list as a array.
- See Also:
- setListItems
addItem
public synchronized void addItem(String item,
boolean bEnabled)
- Adds an item to the end of the list and conditionally enables
it.
- Parameters:
- item - the item to be added
- bEnabled - if true, enable the item; if false, disable
the item
- See Also:
- setListItems, addItem, addItem, addItem, addItem
addItem
public synchronized void addItem(Image image,
String item)
- Adds an item with an image to the end of the list and enables
it.
- Parameters:
- image - the image to display on the item line
- item - the item to be added
- See Also:
- setListItems, addItem, addItem, addItem, addItem
addItem
public synchronized void addItem(Image image,
String item,
boolean bEnabled)
- Adds an item with an image to the end of the list and
conditionally enables it.
- Parameters:
- image - the image to display on the item line
- item - the item to be added
- bEnabled - if true, enable the item; if false, disable the item
- See Also:
- setListItems, addItem, addItem, addItem, addItem
addItem
public synchronized void addItem(Image image,
String item,
boolean bEnabled,
Color color)
- Adds an item with an image to the end of the list and
conditionally enables it. The item text will be displayed in the
given color.
- Parameters:
- image - the image to display on the item line
- item - the item to be added
- bEnabled - if true, enable the item; if false, disable the item
- color - the color of the item's text
- See Also:
- setListItems, addItem, addItem, addItem, addItem
insertItem
public synchronized void insertItem(int index,
Image image,
String item,
boolean bEnabled)
- Inserts an item with an image at a specific zero-relative index and
conditionally enables it.
- Parameters:
- index - the zero-relative index to insert at
- image - the image to display on the item line
- item - the item to be added
- bEnabled - if true, enable the item; if false, disable the item
insertItems
public synchronized void insertItems(int index,
Vector itemVector,
Image image,
boolean bEnabled)
- Inserts a vector list of items at a specific zero-relative index and
conditionally enables them.
Each item will be displayed with the given image.
- Parameters:
- index - the zero-relative index to insert at
- itemVector - the item vector to be added
- image - the image to display for all inserted items
- bEnabled - if true, enable the items; if false, disable the items
countItems
public int countItems()
- Returns the total number of items in the list.
- Returns:
- the number of items in the list
- See Also:
- getItem
getItem
public String getItem(int index)
- Gets the item associated with the specified zero-relative index.
- Parameters:
- index - the zero-relative position of the item
- Returns:
- the item text, or null if the index is invalid
- See Also:
- countItems
getImage
public Image getImage(int index)
- Gets the image associated with the item at the specified zero-relative index.
- Parameters:
- index - the zero-relative position of the item
- Returns:
- the image at the index, or null if the index is invalid
- See Also:
- countItems
changeImage
public void changeImage(int index,
Image image)
- Changes the image associated with the item at the specified
zero-relative index.
- Parameters:
- index - the zero-relative position of the item
- image - the new image to associate with the item
changeText
public void changeText(int index,
String text)
- Changes the text associated with the item at the specified
zero-relative index.
- Parameters:
- index - the zero-relative position of the item
- text - the new text to associate with the item
setEdited
public void setEdited(int index,
boolean bCond)
- Sets a flag indicating that the item at the given zero-relative index
has been edited.
- Parameters:
- index - the zero-relative position of the item
- bCond - the "edited" flag
- See Also:
- getEdited
getEdited
public boolean getEdited(int index)
- Gets the "edited" flag state for the item at the given
zero-relative index.
- Parameters:
- index - the zero-relative position of the item
- Returns:
- true if flagged as edited, false if not
- See Also:
- setEdited
enable
public void enable(int index)
- Enables the specified item in the list.
- Parameters:
- index - the zero-relative position of the item
- See Also:
- disable
disable
public void disable(int index)
- Disables the specified item in the list.
- Parameters:
- index - the zero-relative position of the item
- See Also:
- enable
enable
public void enable(int index,
boolean cond)
- Conditionally enables the specified item in the list.
- Parameters:
- index - the zero-relative position of the item
- cond - if true, enable the item; if false, disable the
item
- See Also:
- isEnabled
isEnabled
public boolean isEnabled(int index)
- Gets the enabled state of a specific item in the list.
- Parameters:
- index - the zero-relative position of the item in the list
- Returns:
- true if the item is enabled, false
if the item is disabled.
- See Also:
- enable
clear
public synchronized void clear()
- Deletes all items and images from the list.
- See Also:
- delItem, delItems
delItem
public synchronized void delItem(int index)
- Deletes the specified item from the list.
- Parameters:
- index - the zero-relative index of the item to delete
- See Also:
- delItems, delSelectedItems
delItems
public synchronized void delItems(int start,
int end)
- Deletes multiple items from the list.
Note that the end index must be greater than or
equal to the start index.
- Parameters:
- start - the zero-relative start index of the items to delete
- end - the zero-relative end index of the items to delete
- See Also:
- delItem, delSelectedItems
delSelectedItems
public synchronized void delSelectedItems()
- Deletes the currently selected items from the list.
- See Also:
- delItem, delItems
getSelectedIndex
public synchronized int getSelectedIndex()
- Gets the zero-relative index of the selected item in the list.
If multiple items are selected, the index of the item most recently
selected is returned.
- Returns:
- the zero-relative index of the selected item, or -1 if no item is
selected
- See Also:
- select, deselect, isSelected
getSelectedIndexes
public synchronized int[] getSelectedIndexes()
- Returns the indexes of all the selected items in the list.
- Returns:
- an array of the zero-relative indexes of the selected items
- See Also:
- select, deselect, isSelected
getSelectedItem
public synchronized String getSelectedItem()
- Returns the currently selected item in the list.
If multiple items are selected, the item most recently
selected is returned.
- Returns:
- the currently selected item, or null if no item is selected.
- See Also:
- getSelectedItems, select, deselect, isSelected
getSelectedItems
public synchronized String[] getSelectedItems()
- Returns all of the the selected items in the list.
- Returns:
- an array of all the selected items in the list
- See Also:
- getSelectedItem, select, deselect, isSelected
getLabel
public synchronized String getLabel()
- Returns the current list box label. Note that this label does not
get displayed.
- Returns:
- the current list box label
select
public synchronized void select(int index)
- Selects the item at the specified index.
This method deselects all others when multiple
selections are not enabled.
- Parameters:
- index - the zero-relative position of the item to select
- See Also:
- getSelectedItem, deselect, isSelected
select
public synchronized void select(String str)
- Selects the first item in the list which has exactly
matching text.
This method deselects all others when multiple
selections are not enabled.
- Parameters:
- str - the text of the item to select in the list
selectMultiple
public synchronized void selectMultiple(int index,
boolean bShift,
boolean bControl)
- Selects an item at the specified index in a multiple-selection-enabled ImageListBox
using Shift, Ctrl or Ctrl-Shift modifiers to mimic mouse
selecting with the Shift, Ctrl or Ctrl-Shift modifiers.
- Parameters:
- index - the zero-relative position of the item to select
- bShift - whether to select with the Shift modifier
- bControl - whether to select with the Ctrl modifier
selectAll
public synchronized void selectAll()
- Selects all the items in the list.
- See Also:
- select, deselectAll
deselect
public synchronized void deselect(int index)
- Deselects the item at the specified index.
- Parameters:
- index - the zero-relative position of the item to deselect
- See Also:
- deselectAll, select, getSelectedItem, isSelected
deselectAll
public synchronized void deselectAll()
- Deselects all items in the list.
- See Also:
- deselect, selectAll
isSelected
public synchronized boolean isSelected(int index)
- Gets the selected state of the item at the given index.
- Parameters:
- index - the zero-relative index of the item to be checked
- Returns:
- true if the item at the specified index
is selected; false if it is not selected
- See Also:
- select, deselect, isSelected
getRows
public int getRows()
- Returns the number of currently visible lines in this list.
- Returns:
- the number of visible lines in the list.
allowsMultipleSelections
public boolean allowsMultipleSelections()
- Returns true if this list allows multiple selections.
- Returns:
- true if multiple selections allowed, false otherwise
- See Also:
- setMultipleSelections
setMultipleSelections
public void setMultipleSelections(boolean cond)
- Sets whether this list should allow multiple selections
or not.
- Parameters:
- cond - whether to allow multiple selections
- See Also:
- allowsMultipleSelections
getVisibleIndex
public int getVisibleIndex()
- Gets the index of the item that was last made visible by
the method makeVisible.
- Returns:
- the zero-relative index of the item last made visible by the
makeVisible method
- See Also:
- makeVisible
makeVisible
public synchronized void makeVisible(int index)
- Scrolls the list as needed to ensure that the specified item is visible.
- Parameters:
- index - the zero-relative position of the item
- See Also:
- getVisibleIndex
setTopRow
public void setTopRow(int index)
- Forces the item at the specified index to be visible at
the top of the window.
- Parameters:
- index - the zero-relative position of the item
preferredSize
public Dimension preferredSize(int rows)
- Returns the preferred dimensions needed for the list with
the specified number of rows.
- Parameters:
- rows - the number of visible rows in the list
- Returns:
- the preferred size to show the specified number of rows
preferredSize
public Dimension preferredSize()
- Returns the recommended dimensions to properly display this component.
This is a standard Java AWT method which gets called to determine
the recommended size of this component.
The size returned is big enough to show the maximum number of visible
rows as requested when constructed, or all the rows currently in the list.
- Overrides:
- preferredSize in class Container
- See Also:
- minimumSize
minimumSize
public Dimension minimumSize(int rows)
- Returns the minimum dimensions needed to show the given number of rows
in the list.
- Parameters:
- rows - the number of visible rows in the list
- Returns:
- the minimum size of this list to show the given number of rows
minimumSize
public Dimension minimumSize()
- Returns the minimum dimensions to properly display this component.
This is a standard Java AWT method which gets called to determine
the minimum size of this component.
The size returned is big enough to show the maximum number of visible
rows as requested when constructed, or all the rows currently in the list.
- Overrides:
- minimumSize in class Container
- See Also:
- preferredSize
addNotify
public void addNotify()
- Tells this component that it has been added to a container.
This is a standard Java AWT method which gets called by the AWT when
this component is added to a container. Typically, it is used to
create this component's peer.
It is overridden here to handle list metrics after the peer is created.
- Overrides:
- addNotify in class Panel
- See Also:
- removeNotify
setColumns
public synchronized void setColumns(int columns)
- Sets the number of columns to be used by minimumSize().
- Parameters:
- columns - the number of columns
blockPaint
public synchronized void blockPaint(boolean cond)
- Blocks the repainting of the control.
- Parameters:
- cond - true to prevent updating the component, false for normal
painting behavior
setFont
public synchronized void setFont(Font f)
- Sets this component's text font.
This is a standard Java AWT method which gets called to change
the font used for drawing text in this component.
In this case the text is in the list box items.
Note that this method is the same as SetListBoxFont().
- Parameters:
- f - the new font to use for drawing text
- Overrides:
- setFont in class Component
- See Also:
- getFont, getListBoxFont, setListBoxFont
setListBoxFont
public synchronized void setListBoxFont(Font f)
- Sets the font for the items in the list box. Note: this method is the
same as setFont().
- Parameters:
- f - the new font to use for list box items
- See Also:
- getListBoxFont
getListBoxFont
public synchronized Font getListBoxFont()
- Returns the font used for the list box items.
- See Also:
- setListBoxFont
scrollVertical
public synchronized void scrollVertical(int info,
boolean bAbsolute)
- Scrolls the ImageListBox vertically.
- Parameters:
- info - either an absolute value or Event.SCROLL_PAGE_DOWN,
Event.SCROLL_PAGE_UP, Event.SCROLL_LINE_DOWN, Event.SCROLL_LINE_UP.
The range for an absolute value should be between 0 and (number of rows-1).
- bAbsolute - true to treat the info parameter as an absolute value,
false to treat it as one of the SCROLL_... constants
scrollHorizontal
public synchronized void scrollHorizontal(int info,
boolean bAbsolute)
- Scrolls the ImageListBox horizontally
- Parameters:
- info - either an absolute value or Event.SCROLL_PAGE_DOWN,
Event.SCROLL_PAGE_UP, Event.SCROLL_LINE_DOWN, Event.SCROLL_LINE_UP.
The range for absolute value should be between 0 and the width of the
largest item, in pixels
- bAbsolute - true to treat the info parameter as an absolute value,
false to treat it as one of the SCROLL_... constants
update
public synchronized void update(Graphics g)
- Handles redrawing of this component on the screen.
This is a standard Java AWT method which gets called by the Java
AWT (repaint()) to handle repainting this component on the screen.
The graphics context clipping region is set to the bounding rectangle
of this component and its <0,0> coordinate is this component's
top-left corner.
Typically this method paints the background color to clear the
component's drawing space, sets graphics context to be the foreground
color, and then calls paint() to draw the component.
It is overridden here to prevent the flicker associated with the standard
update() method's repainting of the background before painting the component
itself,
and to allow the blocking of painting entirely.
- Parameters:
- g - the graphics context
- Overrides:
- update in class Component
- See Also:
- repaint, paint
paint
public synchronized void paint(Graphics g)
- Paints this component using the given graphics context.
This is a standard Java AWT method which typically gets called
by the AWT to handle painting this component. It paints this component
using the given graphics context. The graphics context clipping region
is set to the bounding rectangle of this component and its <0,0>
coordinate is this component's top-left corner.
- Parameters:
- g - the graphics context used for painting
- Overrides:
- paint in class Container
- See Also:
- repaint, update
extraPaint
public void extraPaint(Graphics g,
Rectangle rect)
- Override this method to add any special painting effects after text and images are painted
- Parameters:
- g - the graphics
- rect - the bounding rectangle
show
public synchronized void show()
- Makes this component visible.
This is a standard Java AWT method which gets called to show this
component. If this component was invisible due to a previous hide()
call it make this component visible again.
- Overrides:
- show in class Component
- See Also:
- hide
reshape
public synchronized void reshape(int x,
int y,
int width,
int height)
- Moves and/or resizes this component.
This is a standard Java AWT method which gets called to move and/or
resize this component. Components that are in containers with layout
managers should not call this method, but rely on the layout manager
instead.
- Parameters:
- x - horizontal position in the parent's coordinate space
- y - vertical position in the parent's coordinate space
- width - the new width
- height - the new height
- Overrides:
- reshape in class Component
setDirty
public synchronized void setDirty()
- Set the list to be "dirty" to force a complete
paint on next repaint.
allSelected
public boolean allSelected()
- Query if all of the rows are selected.
- Returns:
- returns true if all rows are selected
setDirectNotify
public void setDirectNotify(boolean bDirectNotify)
- The ImageListBox posts LIST_SELECT and ACTION_EVENT events
directly to a specific parent if one is specified. If one
is not specified, the event is posted directly to the parent
container unless the bDirectNotify notify flag is set to
false. In that case the event is posted to self so that
an extended class can handle it.
- Parameters:
- bDirectNotify - true to directly notify parent with
event, false to post events to self so extended classes can handle it
validIndex
protected boolean validIndex(int index)
- Determines if the given index is valid.
- Parameters:
- index - a zero-relative index to check
- Returns:
- true if the index is valid, false if not
isVisibleIndex
protected boolean isVisibleIndex(int index)
- Determines if the item at the given index is visible.
- Parameters:
- index - the zero-relative index of the item to check
- Returns:
- true if the item is visible, false if not
paramString
protected String paramString()
- Returns a string representing the state of this object.
This is a standard Java AWT method which can be usefull for debugging.
- Returns:
- a handy string for debugging purposes
- Overrides:
- paramString in class Container
shiftSelect
protected void shiftSelect(int index,
boolean bControl)
- Selects an index in a multiple-selection-enabled ImageListBox
using Shift or Ctrl-Shift modifiers to mimic mouse
selecting with the Shift or Ctrl-Shift modifiers.
- Parameters:
- index - the zero-relative position of the item to select
- bControl - whether to select with the Ctrl modifier
ctrlSelect
protected void ctrlSelect(int index)
- Selects an index in a ImageListBox using the Ctrl modifier
to mimic mouse selecting with the Ctrl modifier.
- Parameters:
- index - the zero-relative position of the item to select
mouseCalcIndex
protected int mouseCalcIndex(int y)
- A utility routine that determines the index of the item the mouse is in,
given the vertical coordinate of the mouse.
- Parameters:
- y - mouse vertical (y) coordinate
- Returns:
- the zero-relative index of the item the mouse is in, or -1 if
past the end of the list
All Packages Class Hierarchy This Package Previous Next Index