public class JChoice<E> extends JPanel implements ItemSelectable
maximumFastChoices
) then the options are represented as a
set of buttons in a flow layout. If more options are available, a
simple JComboBox
is used instead.JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_FAST_CHOICES
The default value for the
maximumFastChoices parameter. |
static int |
DEFAULT_MAX_WIDTH
The default value for the
maximumWidth parameter. |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
JChoice()
Creates a FastChoice with a default empty data model.
|
JChoice(ComboBoxModel<E> model)
Creates a FastChoice with the given data model.
|
JChoice(E[] items)
Creates a FastChoice with a default data model populated from the provided
array of objects.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener l) |
void |
addItemListener(ItemListener listener) |
void |
addListDataListener(ListDataListener l) |
Insets |
getDefaultButtonMargin() |
Object |
getElementAt(int index) |
int |
getItemCount() |
int |
getMaximumFastChoices() |
int |
getMaximumWidth() |
ComboBoxModel<E> |
getModel() |
Dimension |
getPreferredSize() |
Object |
getSelectedItem() |
Object[] |
getSelectedObjects() |
static void |
main(String[] args) |
void |
removeActionListener(ActionListener l) |
void |
removeItemListener(ItemListener listener) |
void |
removeListDataListener(ListDataListener l) |
void |
setDefaultButtonMargin(Insets defaultButtonMargin) |
void |
setMaximumFastChoices(int maximumFastChoices) |
void |
setMaximumWidth(int maximumWidth) |
void |
setModel(ComboBoxModel<E> model) |
void |
setSelectedItem(Object anItem) |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, 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, 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, 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, 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 final int DEFAULT_MAX_WIDTH
maximumWidth
parameter.public static final int DEFAULT_MAX_FAST_CHOICES
maximumFastChoices
parameter.public JChoice()
public JChoice(ComboBoxModel<E> model)
public JChoice(E[] items)
public Object[] getSelectedObjects()
getSelectedObjects
in interface ItemSelectable
public static void main(String[] args)
public void removeActionListener(ActionListener l)
l
- JComboBox.removeActionListener(java.awt.event.ActionListener)
public void removeItemListener(ItemListener listener)
removeItemListener
in interface ItemSelectable
listener
- JComboBox.removeItemListener(java.awt.event.ItemListener)
public void addActionListener(ActionListener l)
l
- JComboBox.addActionListener(java.awt.event.ActionListener)
public void addItemListener(ItemListener listener)
addItemListener
in interface ItemSelectable
listener
- JComboBox.addItemListener(java.awt.event.ItemListener)
public void addListDataListener(ListDataListener l)
l
- ListModel.addListDataListener(javax.swing.event.ListDataListener)
public Object getElementAt(int index)
ListModel.getElementAt(int)
public Object getSelectedItem()
ComboBoxModel.getSelectedItem()
public int getItemCount()
ListModel.getSize()
public void removeListDataListener(ListDataListener l)
l
- ListModel.removeListDataListener(javax.swing.event.ListDataListener)
public void setSelectedItem(Object anItem)
anItem
- ComboBoxModel.setSelectedItem(java.lang.Object)
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public int getMaximumFastChoices()
public void setMaximumFastChoices(int maximumFastChoices)
maximumFastChoices
- the maximumFastChoices to setpublic ComboBoxModel<E> getModel()
public void setModel(ComboBoxModel<E> model)
model
- the model to setpublic int getMaximumWidth()
public void setMaximumWidth(int maximumWidth)
maximumWidth
- the maximumWidth to setpublic Insets getDefaultButtonMargin()
public void setDefaultButtonMargin(Insets defaultButtonMargin)
defaultButtonMargin
- the defaultButtonMargin to setCopyright © 2024 GATE. All rights reserved.