public class MustTextField extends javax.swing.JTextField implements ContextHelp, java.awt.event.KeyListener, Undoable, ModifiedInformer, SearchContent
javax.swing.JTextField.AccessibleJTextField
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected boolean |
capitalization |
protected java.lang.String |
editBeginValue |
protected MustTabbedPane |
locatedTabbedPane |
protected int |
locatedTabbedPaneIndex |
protected java.lang.String |
textBefore |
protected java.awt.Toolkit |
thisToolkit |
protected boolean |
umlautTransformation |
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
Constructor and Description |
---|
MustTextField()
Constructs a new text field with a default size of 20 characters and no
length control.
|
MustTextField(int length)
Constructs a new text field with the specified length.
|
MustTextField(int length,
int maxChars,
boolean controlLength)
Constructs a new text field with length, max chars and length control as specified.
|
Modifier and Type | Method and Description |
---|---|
void |
addContentChangeListener(ContentChangeListener l)
Adds the specified ContentChangeListener to receive content change events.
|
protected void |
fireContentChanged() |
protected void |
fireContentChanged(int changeType) |
protected void |
fireContentChangedDelayed() |
protected void |
fireContentChangedDelayed(java.awt.event.KeyEvent e)
Fires content change event after a delay.
|
protected int |
getColumnWidth()
Returns the column width.
|
java.lang.String |
getContent() |
java.lang.String |
getEditBeginValue()
Returns the value of the text field before user started editing.
|
java.lang.String |
getHelpTarget()
Returns the target of the component's help context.
|
java.lang.String |
getHelpTopic()
Returns the topic of the component's help context.
|
int |
getMaxChars()
Returns the maximum number of characters to be inserted.
|
java.awt.Dimension |
getPreferredSize()
Returns the preferred size.
|
RightMouseProvider |
getRightMouseProvider()
Returns the right mouse provider.
|
boolean |
hasContent()
Returns true if the textfield is filled with more than spaces.
|
boolean |
isFilled()
Indicates whether the component has a value.
|
boolean |
isFilledEvenBlank()
Indicates whether the component has a value even if value is blanks only.
|
boolean |
isModified()
Indicates whether the component's value differs from its initial value.
|
boolean |
isRequired()
Returns true if the text field is specified as mandatory.
|
boolean |
isRequirementUnfulfilled()
Returns true if the component's value is mandatory but not filled.
|
void |
keyPressed(java.awt.event.KeyEvent e) |
void |
keyReleased(java.awt.event.KeyEvent e)
Invoked when a key has been released.
|
void |
keyTyped(java.awt.event.KeyEvent e) |
void |
removeContentChangeListener(ContentChangeListener l)
Removes the specified ContentChangeListener to receive data selection events
from this entity.
|
boolean |
requestFocusInWindow()
Set focus on the receiving component if isRequestFocusEnabled returns true
and ensures, that the tabbed pane switches to the page where this text
field is located.
|
void |
setCapitalization(boolean capitalization)
Sets the capitalization flag.
|
void |
setCapitalizationAndUmlautTransformation(boolean b) |
static void |
setCapitalizationByDefault(boolean capitalization)
Sets the default for capitalization.
|
void |
setControlLength(boolean controlLength)
Sets the length control flag.
|
void |
setFont(java.awt.Font f)
Sets the font.
|
void |
setHelpContext(java.lang.String helpTopic)
Sets the component's context help.
|
void |
setHelpContext(java.lang.String helpTopic,
java.lang.String helpTarget)
Sets the component's context help.
|
void |
setHttpParamToFetch(java.lang.String httpParamToFetch)
Sets the parameter name to fetch the parameter value for the case input is a URL, e.g. by a QR code.
|
void |
setMaxChars(int maxChars)
Sets the maximum number of characters to be inserted
|
void |
setOnSelectAllOnFocusGained()
Sets on 'SelectAll' on event 'focusGained'.
|
void |
setRequired(boolean required)
Sets the previously added component to be mandatory.
|
void |
setTabbedPaneLocation(MustTabbedPane locatedTabbedPane,
int locatedTabbedPaneIndex)
Sets the component's location on the tabbed pane.
|
void |
setText(java.lang.String text)
Sets the text.
|
void |
setTextAsEditBeginValue(java.lang.String text)
Sets the text as edit begin value which causes isModified to return false
as long as user doesn't change the value.
|
void |
setUmlautTransformation(boolean umlautTransformation) |
void |
undo()
Undo last action.
|
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getHorizontalAlignment, getHorizontalVisibility, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setHorizontalAlignment, setScrollOffset
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, 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, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected boolean capitalization
protected boolean umlautTransformation
protected java.awt.Toolkit thisToolkit
protected java.lang.String textBefore
protected java.lang.String editBeginValue
protected MustTabbedPane locatedTabbedPane
protected int locatedTabbedPaneIndex
public MustTextField()
public MustTextField(int length)
length
- the length (size) of the text field
max char specification abovepublic MustTextField(int length, int maxChars, boolean controlLength)
length
- the length (size) of the text fieldmaxChars
- the max characters to be insertedcontrolLength
- if true, characters are removed, if they exceed the
max char specification abovepublic static void setCapitalizationByDefault(boolean capitalization)
capitalization
- whether capitalization should be defaultpublic void setHttpParamToFetch(java.lang.String httpParamToFetch)
httpParamToFetch
- the parameter name to use to fetch the input valuepublic void setControlLength(boolean controlLength)
controlLength
- if true, characters are removed, if they exceed the length definitionpublic RightMouseProvider getRightMouseProvider()
public int getMaxChars()
public void setMaxChars(int maxChars)
maxChars
- the max characters to be insertedpublic void setCapitalizationAndUmlautTransformation(boolean b)
public void setCapitalization(boolean capitalization)
capitalization
- whether all typed letters should be automatically transformed via upperCase();public void setUmlautTransformation(boolean umlautTransformation)
public void setOnSelectAllOnFocusGained()
public void setText(java.lang.String text)
setText
in class javax.swing.text.JTextComponent
newText
- the new textpublic void setFont(java.awt.Font f)
setFont
in class javax.swing.JTextField
f
- the new font.protected int getColumnWidth()
getColumnWidth
in class javax.swing.JTextField
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JTextField
public void setRequired(boolean required)
required
- whether the component is mandatory or notpublic void setHelpContext(java.lang.String helpTopic)
helpTopic
- the context help's topicpublic void setHelpContext(java.lang.String helpTopic, java.lang.String helpTarget)
setHelpContext
in interface ContextHelp
helpTopic
- the context help's topichelpTarget
- the context help's targetpublic java.lang.String getHelpTopic()
getHelpTopic
in interface ContextHelp
public java.lang.String getHelpTarget()
getHelpTarget
in interface ContextHelp
public void setTabbedPaneLocation(MustTabbedPane locatedTabbedPane, int locatedTabbedPaneIndex)
locatedTabbedPane
- the tabbed pane that contains this text fieldlocatedTabbedPaneIndex
- the page's index of the tabbed panepublic boolean requestFocusInWindow()
requestFocusInWindow
in class javax.swing.JComponent
public boolean isRequired()
public boolean isRequirementUnfulfilled()
public void setTextAsEditBeginValue(java.lang.String text)
newText
- the new textpublic boolean isFilledEvenBlank()
public boolean isFilled()
public boolean isModified()
ModifiedInformer
isModified
in interface ModifiedInformer
public java.lang.String getEditBeginValue()
public java.lang.String getContent()
getContent
in interface SearchContent
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
e
- the key eventpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public boolean hasContent()
protected void fireContentChangedDelayed(java.awt.event.KeyEvent e)
e
- the key event causing the content changeprotected void fireContentChangedDelayed()
public void addContentChangeListener(ContentChangeListener l)
public void removeContentChangeListener(ContentChangeListener l)
DataSelectionEvent
protected void fireContentChanged()
protected void fireContentChanged(int changeType)
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de