|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectComponent
Container
JComponent
JPanel
DisjointLists
public class DisjointLists
A widget showing selected and unselected items in two disjoint list. The list on the left side shows items available for selection. The list on the right side shows items already selected. User can move items from one list to the other using buttons in the middle.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DisjointLists()
Construct a new list. |
Method Summary | |
---|---|
void |
addElements(Collection items)
Add all elements from the specified collection into the list on the left side. |
void |
addElements(Object[] items)
Add all elements from the specified array into the list on the left side. |
void |
clear()
Removes all elements from this list. |
Collection |
getElements(boolean selected)
Returns all elements with the specified selection state. |
boolean |
isAutoSortEnabled()
Returns true if elements are automatically sorted when added to this list. |
static void |
main(String[] args)
Show the dialog box. |
void |
selectElements(Collection selected)
Add the specified elements to the selection list (the one to appears on the right side). |
void |
setAutoSortEnabled(boolean autoSort)
Sets to true if elements should be automatically sorted when added to this list. |
void |
setFont(Font font)
Set the font for both lists on the left and right side. |
boolean |
showDialog(Component owner,
String title)
Display this component in a dialog box and wait for the user to press "Ok". |
Methods inherited from class JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DisjointLists()
Method Detail |
---|
public boolean isAutoSortEnabled()
true
if elements are automatically sorted when added to this list.
The default value is true
.
public void setAutoSortEnabled(boolean autoSort)
true
if elements should be automatically sorted when added to this list.
public void clear()
public void addElements(Collection items)
isAutoSortEnabled()
returns true
.
items
- Items to add.public void addElements(Object[] items)
isAutoSortEnabled()
returns true
.
items
- Items to add.public Collection getElements(boolean selected)
selected
is true
,
then this method returns the selected elements on the right side. If selected
is
false
, then this method returns the unselected elements on the left side.
public void selectElements(Collection selected)
selected
collection has not been previously added, it will be ignored.
public void setFont(Font font)
setFont
in class JComponent
public boolean showDialog(Component owner, String title)
owner
- The owner (may be null).title
- The title to write in the window bar.
true
if the user pressed "okay", or false
otherwise.public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |