T
- the type of the entries of this listpublic abstract class GUIComboBox<T> extends AbstractGUIElement
GUIElement
that displays a combo box.javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private java.awt.event.ActionListener |
actionListener
The
ActionListener for comboBox . |
private javax.swing.JComboBox<T> |
comboBox
The Swing component that implements the combo box.
|
private GUILabelLog |
label
The
GUILog to update or null . |
private javax.swing.DefaultComboBoxModel<T> |
model
The model for
comboBox . |
private javax.swing.ListCellRenderer<T> |
renderer
The
ListCellRenderer for comboBox . |
private static long |
serialVersionUID
The serial version UID.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Modifier | Constructor and Description |
---|---|
protected |
GUIComboBox(TooltipManager tooltipManager,
GUIElementListener elementListener,
java.lang.String name,
GUILabelLog label)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Releases all allocated resources.
|
protected abstract java.lang.String |
getDescription(T item)
Returns the description for an item.
|
protected abstract java.awt.Component |
getListCellRendererComponent(javax.swing.JList<? extends T> list,
T value,
int index,
boolean selected,
boolean cellHasFocus)
Returns a
Component that displays the value . |
java.awt.Dimension |
getMinimumSize() |
java.awt.Dimension |
getPreferredSize() |
void |
setBounds(int x,
int y,
int width,
int height) |
protected void |
updateModel(java.lang.Iterable<T> elements)
Updates entries shown in the combo box.
|
protected void |
updateSelectedItem()
Called whenever the selected item has changed.
|
getName, hasTooltipText, isDefault, isIgnore, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, setChanged, setChangedListener, setDefault, setIgnore, setTooltipText, setTooltipText, toString
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
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, 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, getAccessibleContext, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
@NotNull private final java.awt.event.ActionListener actionListener
ActionListener
for comboBox
.@NotNull private final javax.swing.JComboBox<T> comboBox
@Nullable private final GUILabelLog label
GUILog
to update or null
.@NotNull private final javax.swing.ListCellRenderer<T> renderer
ListCellRenderer
for comboBox
.private static final long serialVersionUID
protected GUIComboBox(@NotNull TooltipManager tooltipManager, @NotNull GUIElementListener elementListener, @NotNull java.lang.String name, @Nullable GUILabelLog label)
tooltipManager
- the tooltip manager to updateelementListener
- the element listener to notifyname
- the name of this elementlabel
- the label to update or null
public void dispose()
dispose
in interface GUIElement
dispose
in class AbstractGUIElement
@NotNull protected abstract java.lang.String getDescription(@NotNull T item)
item
- the item@NotNull protected abstract java.awt.Component getListCellRendererComponent(@NotNull javax.swing.JList<? extends T> list, @Nullable T value, int index, boolean selected, boolean cellHasFocus)
Component
that displays the value
.list
- the list that contains the valuevalue
- the value that is displayed or null
index
- the list indexselected
- whether the value is selectedcellHasFocus
- whether the value has the focuspublic java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void setBounds(int x, int y, int width, int height)
setBounds
in class java.awt.Component
protected void updateModel(@NotNull java.lang.Iterable<T> elements)
elements
- the new entries to showprotected void updateSelectedItem()