Class JLabeledTextArea
-
- All Implemented Interfaces:
-
java.awt.MenuContainer,java.awt.event.FocusListener,java.awt.image.ImageObserver,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible,javax.swing.TransferHandler.HasGetTransferHandler,org.apache.jorphan.gui.JLabeledField
public class JLabeledTextArea extends JPanel implements JLabeledField, FocusListener
A Helper component that wraps a JTextField with a label into a JPanel (this). This component also has an efficient event handling mechanism for handling the text changing in the Text Field. The registered change listeners are only called when the text has changed.
-
-
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 JLabeledTextArea()Default constructor, The label and the Text field are left empty. JLabeledTextArea(String label)Constructs a new component with the label displaying the passed text. JLabeledTextArea(String pLabel, Document docModel)Constructs a new component with the label displaying the passed text.
-
Method Summary
Modifier and Type Method Description List<JComponent>getComponentList()Get the label JLabel followed by the text field @link JTextArea. voidsetDocumentModel(Document docModel)voidfocusLost(FocusEvent pFocusEvent)Callback method when the focus to the Text Field component is lost. voidfocusGained(FocusEvent pFocusEvent)Catch what the value was when focus was gained. voidsetLabel(String pLabel)Set the text displayed in the label. voidsetText(String pText)Set the text displayed in the Text Field. StringgetText()Returns the text in the Text Field. StringgetLabel()Returns the text of the label. voidsetEnabled(boolean enable)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. Array<String>getTextLines()-
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, 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
-
JLabeledTextArea
JLabeledTextArea()
Default constructor, The label and the Text field are left empty.
-
JLabeledTextArea
JLabeledTextArea(String label)
Constructs a new component with the label displaying the passed text.- Parameters:
label- The text to display in the label.
-
-
Method Detail
-
getComponentList
List<JComponent> getComponentList()
-
setDocumentModel
void setDocumentModel(Document docModel)
-
focusLost
void focusLost(FocusEvent pFocusEvent)
Callback method when the focus to the Text Field component is lost.
- Parameters:
pFocusEvent- The focus event that occurred.
-
focusGained
void focusGained(FocusEvent pFocusEvent)
Catch what the value was when focus was gained.
-
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.
-
setEnabled
void setEnabled(boolean enable)
-
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.
-
getTextLines
Array<String> getTextLines()
-
-
-
-