public class MustList extends javax.swing.JList<java.lang.String> implements java.awt.event.MouseListener, java.awt.event.KeyListener, javax.swing.event.ListSelectionListener, AnySelectionSpeaker
javax.swing.JList.AccessibleJList, javax.swing.JList.DropLocation
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
MustList()
Constructs a new list.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnySelectionListener(AnySelectionListener l)
Adds a selection listener to be notified about selection changed events.
|
void |
addIndexedItem(java.lang.String visualItem,
Identifier identifier)
Adds an item to the list and assigns its identifier
|
void |
addItem(java.lang.String item)
Adds an item to the list.
|
void |
applyNewModel()
Applies the new model, prepared previously in disconnected state.
|
void |
fireSelectionChanged()
Informs all registered components about the selection changed event.
|
java.awt.Color |
getBackground() |
Identifier |
getIdentifier(int listIndex)
Returns the identifier of the specified item.
|
IndentifierListModel |
getIdModel() |
int |
getItemCount()
Returns the size of the list.
|
Identifier |
getSelectedIdentifier()
Returns the selected identifier (in case of integer identification).
|
Identifier[] |
getSelectedIdentifiers() |
java.lang.String |
getSelectedItem()
Returns the selected item.
|
protected java.lang.String |
getTranslation(java.lang.String resourceKey)
Returns a text in the corresponding language according to the locale
specific resource bundle of the package.
|
void |
keyPressed(java.awt.event.KeyEvent e) |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e) |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
prepareModelForExtension()
To be called as a workaround to avoid painting problems by dynamic JList extension.
|
void |
prepareNewModel()
Prepares a new model to be applied later by calling applyNewModel().
|
void |
remove(int itemIndex)
Removes an item out of the list including its identifier.
|
void |
removeAll()
Removes all items of the list and clears the identifier array.
|
void |
removeAnySelectionListener(AnySelectionListener l)
Removes a selection listener to be notified about selection changed events.
|
static void |
setBackgroundColor(java.awt.Color color) |
void |
setEnterButton(MustButton enterButton)
Sets the button to be clicked if enter is pressed or the item is double clicked.
|
void |
setPopupReceiver(java.awt.event.ActionListener actionListener,
MustPopupMenu.PopupReceiver receiver)
Sets the pop up receiver to listen to events requesting a pop up menu.
|
void |
setSelectedIndex(int index)
Selects an item and ensures, that it is visible.
|
void |
updateItem(java.lang.String visualItem,
int index)
Updates an item.
|
void |
valueChanged(javax.swing.event.ListSelectionEvent e) |
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectedValuesList, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static void setBackgroundColor(java.awt.Color color)
public void setEnterButton(MustButton enterButton)
enterButton
- the new item default buttonpublic IndentifierListModel getIdModel()
public void prepareModelForExtension()
public void prepareNewModel()
applyNewModel()
public void applyNewModel()
prepareNewModel()
,
prepareModelForExtension()
public void removeAll()
removeAll
in class java.awt.Container
public void remove(int itemIndex)
remove
in class java.awt.Container
itemIndex
- the item to be removedpublic void setSelectedIndex(int index)
setSelectedIndex
in class javax.swing.JList<java.lang.String>
index
- the item to be selectedpublic void addItem(java.lang.String item)
item
- the item to addpublic void addIndexedItem(java.lang.String visualItem, Identifier identifier)
visualItem
- the item to addidentifier
- the identifier of the itempublic void updateItem(java.lang.String visualItem, int index)
visualItem
- the new item valueindex
- the position of the item to be updatedpublic void setPopupReceiver(java.awt.event.ActionListener actionListener, MustPopupMenu.PopupReceiver receiver)
actionListener
- the listener for action caused by the pop up menureceiver
- the receiver of the pop up menupublic int getItemCount()
public java.lang.String getSelectedItem()
public Identifier getSelectedIdentifier()
public Identifier[] getSelectedIdentifiers()
public Identifier getIdentifier(int listIndex)
listIndex
- the index of the itempublic java.awt.Color getBackground()
getBackground
in class java.awt.Component
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged
in interface javax.swing.event.ListSelectionListener
public void addAnySelectionListener(AnySelectionListener l)
addAnySelectionListener
in interface AnySelectionSpeaker
l
- the selection listener to be notifiedpublic void removeAnySelectionListener(AnySelectionListener l)
removeAnySelectionListener
in interface AnySelectionSpeaker
l
- the selection listenerpublic void fireSelectionChanged()
protected java.lang.String getTranslation(java.lang.String resourceKey)
resourceKey
- the key of the resource to retrieveCopyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de