public class PopupList
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) List |
list |
(package private) int |
minimumWidth |
(package private) Shell |
shell |
Constructor and Description |
---|
PopupList(Shell parent)
Creates a PopupList above the specified shell.
|
PopupList(Shell parent,
int style)
Creates a PopupList above the specified shell.
|
Modifier and Type | Method and Description |
---|---|
private static int |
checkStyle(int style) |
Font |
getFont()
Gets the widget font.
|
java.lang.String[] |
getItems()
Gets the items.
|
int |
getMinimumWidth()
Gets the minimum width of the list.
|
java.lang.String |
open(Rectangle rect)
Launches the Popup List, waits for an item to be selected and then closes the PopupList.
|
void |
select(java.lang.String string)
Selects an item with text that starts with specified String.
|
void |
setFont(Font font)
Sets the widget font.
|
void |
setItems(java.lang.String[] strings)
Sets all items.
|
void |
setMinimumWidth(int width)
Sets the minimum width of the list.
|
public PopupList(Shell parent)
parent
- a Shell control which will be the parent of the new instance (cannot be null)public PopupList(Shell parent, int style)
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructprivate static int checkStyle(int style)
public Font getFont()
SWTException
- public java.lang.String[] getItems()
This operation will fail if the items cannot be queried from the OS.
SWTException
- public int getMinimumWidth()
public java.lang.String open(Rectangle rect)
rect
- the initial size and location of the PopupList; the dialog will be
positioned so that it does not run off the screen and the largest number of items are visiblepublic void select(java.lang.String string)
If the item is not currently selected, it is selected. If the item at an index is selected, it remains selected. If the string is not matched, it is ignored.
string
- the text of the itemSWTException
- public void setFont(Font font)
When new font is null, the font reverts to the default system font for the widget.
font
- the new font (or null)SWTException
- public void setItems(java.lang.String[] strings)
The previous selection is cleared. The previous items are deleted. The new items are added. The top index is set to 0.
strings
- the array of items
This operation will fail when an item is null
or could not be added in the OS.java.lang.IllegalArgumentException
- SWTException
- public void setMinimumWidth(int width)
width
- the minimum width of the list