Class EditableList
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.sun.javatest.tool.EditableList
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
- Direct Known Subclasses:
EditableFileList
A component that displays an editable list of items.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DefaultListModel<Object> The list model that contains the elements of the list.protected final UIFactoryThe factory used to create the GUI elements of the component.Fields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty component, using a standard UIFactory for this class, and using resources beginning with "list.".EditableList(UIFactory uif, String uiKey) Create an empty component, using a specified UIFactory and resource prefix. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener to be notified of events when the list data changes.voidclear()Remove all entries from the list.Get the accessible context for this pane.protected ObjectgetDisplayValue(Object item) Get the display value for an item in the list.Object[]getItems()Get the items currently in the list.Object[]Get the items currently in the list, in an array of a specific type.protected ObjectInvoked to get a new item to put in the list, when the user clicks the "Add" button".protected ObjectgetNewItem(Object oldItem) Invoked to get a new item to replace an existing item in the list.Get the tool tip text that appears on the list.booleanCheck whether or not duplicates should be allowed in the list.voidRemove a listener that was previously added to be notified of events when the list data changes.voidsetDuplicatesAllowed(boolean b) Specify whether or not duplicates should be allowed in the list.voidsetEnabled(boolean b) Set whether or not the list can be edited by the user.voidSet the items in the list.voidsetToolTipText(String tip) Set the tool tip text that appears on the list.Methods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
uif
The factory used to create the GUI elements of the component. -
listModel
The list model that contains the elements of the list.
-
-
Constructor Details
-
EditableList
public EditableList()Create an empty component, using a standard UIFactory for this class, and using resources beginning with "list.". -
EditableList
-
-
Method Details
-
getAccessibleContext
Get the accessible context for this pane.- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classComponent- Returns:
- the accessible context for this pane
-
setEnabled
public void setEnabled(boolean b) Set whether or not the list can be edited by the user.- Overrides:
setEnabledin classJComponent- Parameters:
b- if true, the component can be edited by the user; if false, it cannot
-
clear
public void clear()Remove all entries from the list. -
getItems
Get the items currently in the list.- Returns:
- an array containing the items currently in the list
- See Also:
-
setItems
Set the items in the list. Any previous items are removed first.- Parameters:
items- the array of items to be put in the list.- See Also:
-
getItems
-
getToolTipText
Get the tool tip text that appears on the list. (Separate tool tip text will appear on the buttons to manipulate the list.)- Overrides:
getToolTipTextin classJComponent- Returns:
- the tool tip text that appears on the list
- See Also:
-
setToolTipText
Set the tool tip text that appears on the list. (Separate tool tip text will appear on the buttons to manipulate the list.)- Overrides:
setToolTipTextin classJComponent- Parameters:
tip- the tool tip text to appear on the list- See Also:
-
addListDataListener
Add a listener to be notified of events when the list data changes.- Parameters:
l- the listener to be notified- See Also:
-
removeListDataListener
Remove a listener that was previously added to be notified of events when the list data changes.- Parameters:
l- the listener to be notified- See Also:
-
isDuplicatesAllowed
public boolean isDuplicatesAllowed()Check whether or not duplicates should be allowed in the list.- Returns:
- true if duplicates should be allowed, and false otherwise
- See Also:
-
setDuplicatesAllowed
public void setDuplicatesAllowed(boolean b) Specify whether or not duplicates should be allowed in the list.- Parameters:
b- true if duplicates should be allowed, and false otherwise- See Also:
-
getDisplayValue
-
getNewItem
Invoked to get a new item to put in the list, when the user clicks the "Add" button". The default is to show an input dialog to allow the user to type in a new string. Subtypes may override this method to provide other ways of specifying items to be added, such as a file chooser.- Returns:
- an object to be added to the list, or null if no object to be added.
-
getNewItem
Invoked to get a new item to replace an existing item in the list. The default is to show an input dialog to allow the user to type in a new string. Subtypes may override this method to provide other ways of specifying items to be added, such as a file chooser.- Parameters:
oldItem- the item to be replaced in the list- Returns:
- an object to replace the old item the list, or null if no replacement should occur.
-