Package org.apache.jorphan.gui
Class JLabeledChoice
-
- All Implemented Interfaces:
-
java.awt.MenuContainer,java.awt.image.ImageObserver,java.io.Serializable,javax.accessibility.Accessible,javax.swing.TransferHandler.HasGetTransferHandler,org.apache.jorphan.gui.JLabeledField
public class JLabeledChoice extends JPanel implements JLabeledField
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringuiClassIDpublic floatalignmentXpublic floatalignmentYpublic booleanautoscrollspublic Borderborderpublic InputVerifierinputVerifierpublic booleanverifyInputWhenFocusTargetpublic final static intWHEN_FOCUSEDpublic final static intWHEN_ANCESTOR_OF_FOCUSED_COMPONENTpublic final static intWHEN_IN_FOCUSED_WINDOWpublic final static intUNDEFINED_CONDITIONpublic final static StringTOOL_TIP_TEXT_KEYpublic ActionMapactionMappublic transient FocusTraversalPolicyfocusTraversalPolicypublic transient Containerparentpublic intxpublic intypublic intwidthpublic intheightpublic Colorforegroundpublic Colorbackgroundpublic volatile Fontfontpublic Cursorcursorpublic Localelocalepublic booleanignoreRepaintpublic DropTargetdropTargetpublic Stringnamepublic booleanfocusTraversalKeysEnabledpublic transient ComponentOrientationcomponentOrientationpublic final static floatTOP_ALIGNMENTpublic final static floatCENTER_ALIGNMENTpublic final static floatBOTTOM_ALIGNMENTpublic final static floatLEFT_ALIGNMENTpublic final static floatRIGHT_ALIGNMENTpublic final static intWIDTHpublic final static intHEIGHTpublic final static intPROPERTIESpublic final static intSOMEBITSpublic final static intFRAMEBITSpublic final static intALLBITSpublic final static intERRORpublic final static intABORT
-
Constructor Summary
Constructors Constructor Description JLabeledChoice()Default constructor, The label and the Text field are left empty. JLabeledChoice(String pLabel, boolean editable)JLabeledChoice(String pLabel, Array<String> items)Constructs a non-editable combo-box with the label displaying the passed text. JLabeledChoice(String pLabel, Array<String> items, boolean editable)Constructs a combo-box with the label displaying the passed text. JLabeledChoice(String pLabel, Array<String> items, boolean editable, boolean withButtons)Constructs a combo-box with the label displaying the passed text.
-
Method Summary
Modifier and Type Method Description List<JComponent>getComponentList()Get the label JLabel followed by the combo-box @link JComboBox. voidsetEditable(boolean editable)voidaddValue(String item)voidsetValues(Array<String> items)voidsetChoiceListEnabled(boolean enabled)voidsetLabel(String pLabel)Set the text displayed in the label. voidsetText(String pText)Set the text displayed in the Text Field. voidsetSelectedIndex(int index)StringgetText()Returns the text in the Text Field. intgetSelectedIndex()Array<Object>getSelectedItems()Array<String>getItems()StringgetLabel()Returns the text of the label. voidsetToolTipText(String text)Registers the text to display in a tool tip. StringgetToolTipText()Returns the tooltip string that has been set with setToolTipText voidaddChangeListener(ChangeListener pChangeListener)Adds a change listener, that will be notified when the text in the text field is changed. voidremoveChangeListener(ChangeListener pChangeListener)Removes a change listener. -
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI -
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, contains, createToolTip, disable, enable, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputVerifier, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getTopLevelAncestor, getTransferHandler, getUI, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update -
Methods inherited from class java.awt.Container
add, add, addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, getComponent, getComponentAt, getComponentCount, getComponentZOrder, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate -
Methods inherited from class java.awt.Component
action, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, createImage, createVolatileImage, dispatchEvent, enableInputMethods, getBackground, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusTraversalKeysEnabled, setFocusable, setIgnoreRepaint, setLocale, setLocation, setMixingCutoutShape, setName, setSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
JLabeledChoice
JLabeledChoice()
Default constructor, The label and the Text field are left empty.
-
JLabeledChoice
JLabeledChoice(String pLabel, boolean editable)
-
JLabeledChoice
JLabeledChoice(String pLabel, Array<String> items)
Constructs a non-editable combo-box with the label displaying the passed text.- Parameters:
pLabel- - the text to display in the label.items- - the items to display in the Combo box
-
JLabeledChoice
JLabeledChoice(String pLabel, Array<String> items, boolean editable)
Constructs a combo-box with the label displaying the passed text.- Parameters:
pLabel- - the text to display in the label.items- - the items to display in the Combo boxeditable- - if true, then Add and Delete buttons are created.
-
JLabeledChoice
JLabeledChoice(String pLabel, Array<String> items, boolean editable, boolean withButtons)
Constructs a combo-box with the label displaying the passed text.- Parameters:
pLabel- - the text to display in the label.items- - the items to display in the Combo boxeditable- - the box is made editablewithButtons- - if true, then Add and Delete buttons are created.
-
-
Method Detail
-
getComponentList
List<JComponent> getComponentList()
-
setEditable
void setEditable(boolean editable)
-
setChoiceListEnabled
void setChoiceListEnabled(boolean enabled)
-
setLabel
void setLabel(String pLabel)
Set the text displayed in the label.
- Parameters:
pLabel- The new label text.
-
setText
void setText(String pText)
Set the text displayed in the Text Field.
- Parameters:
pText- The new text to display in the text field.
-
setSelectedIndex
void setSelectedIndex(int index)
-
getText
String getText()
Returns the text in the Text Field.
- Returns:
The text in the Text Field. Never returns null.
-
getSelectedIndex
int getSelectedIndex()
-
getSelectedItems
Array<Object> getSelectedItems()
-
setToolTipText
void setToolTipText(String text)
Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.
- Parameters:
text- the string to display; if the text is null, the tool tip is turned off for this component
-
getToolTipText
String getToolTipText()
Returns the tooltip string that has been set with setToolTipText
- Returns:
the text of the tool tip
-
addChangeListener
void addChangeListener(ChangeListener pChangeListener)
Adds a change listener, that will be notified when the text in the text field is changed. The ChangeEvent that will be passed to registered listeners will contain this object as the source, allowing the new text to be extracted using the getText method.
- Parameters:
pChangeListener- The listener to add
-
removeChangeListener
void removeChangeListener(ChangeListener pChangeListener)
Removes a change listener.
- Parameters:
pChangeListener- The change listener to remove.
-
-
-
-