|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel gate.gui.annedit.JNullableTextField
public class JNullableTextField
An encapsulation of JTextField
and a JButton
that allows
the text value to be set to null by pressing the button. Provides the minimal
API required for the needs of SchemaFeaturesEditor
.
Nested Class Summary | |
---|---|
protected class |
JNullableTextField.NullifyTextAction
|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected Set<DocumentListener> |
documentListeners
My document listeners. |
protected Color |
normalBgColor
The normal background colour for the text field. |
protected Color |
nullBgColor
The colour used for the text field's background when the value is null. |
protected JButton |
nullifyButton
The button used to clear (nullify) the textual value. |
protected String |
text
The text value, which can be null |
protected JTextField |
textField
The text field used for editing the textual value. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JNullableTextField()
Creates a new JNullableTextField widget. |
Method Summary | |
---|---|
void |
addDocumentListener(DocumentListener listener)
Registers a new DocumentListener with this component. |
protected void |
fireChangedUpdate(DocumentEvent e)
|
protected void |
fireInsertUpdate(DocumentEvent e)
|
protected void |
fireRemoveUpdate(DocumentEvent e)
|
String |
getText()
Gets the value currently being edited. |
protected void |
initGui()
|
protected void |
initListeners()
|
void |
removeDocumentListener(DocumentListener listener)
Removes a previously registered listener (see addDocumentListener(DocumentListener) ). |
void |
setColumns(int cols)
Sets the number of columns for the included JTextField , see
JTextField.setColumns(int) . |
void |
setText(String text)
Sets the value edited by this component. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected JButton nullifyButton
protected JTextField textField
protected Color normalBgColor
protected Color nullBgColor
protected Set<DocumentListener> documentListeners
protected String text
Constructor Detail |
---|
public JNullableTextField()
JNullableTextField
widget.
Method Detail |
---|
public void setText(String text)
DocumentListener
s associated with this
component (see addDocumentListener(DocumentListener)
.
text
- public String getText()
JTextField
, this
value may be null (if setText(String)
was called previously with
a null
value, of the delete button was pressed by the user).
public void setColumns(int cols)
JTextField
, see
JTextField.setColumns(int)
.
protected void initGui()
protected void initListeners()
public void addDocumentListener(DocumentListener listener)
DocumentListener
with this component. The provided
listener will be forwarded all the events generated by the encapsulated
JTextField
. An event will also be generated when the user presses
the delete button, causing the text value to be nullified.
listener
- public void removeDocumentListener(DocumentListener listener)
addDocumentListener(DocumentListener)
).
listener
- protected void fireChangedUpdate(DocumentEvent e)
protected void fireInsertUpdate(DocumentEvent e)
protected void fireRemoveUpdate(DocumentEvent e)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |