|
|||||||||
| Home >> All >> javax >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.swing
Class JTextField

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, Scrollable, java.io.Serializable, SwingConstants
- Direct Known Subclasses:
- JFormattedTextField, JPasswordField, JTable.TableTextField
- public class JTextField
- extends javax.swing.text.JTextComponent
- implements SwingConstants
- extends javax.swing.text.JTextComponent
| Nested Class Summary | |
protected class |
JTextField.AccessibleJTextField
AccessibleJTextField |
| Nested classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
private Action |
action
|
private java.lang.String |
actionCommand
|
private java.beans.PropertyChangeListener |
actionPropertyChangeListener
|
private static Action[] |
actions
|
private int |
align
|
private int |
columns
|
private BoundedRangeModel |
horizontalVisibility
The horizontal visibility of the textfield. |
static java.lang.String |
notifyAction
Name of the action that gets sent when the content of the text field gets accepted. |
private static long |
serialVersionUID
|
| Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, alignmentX, alignmentY, autoscrolls, border, debugGraphicsOptions, doubleBuffered, isCompletelyDirty, isPaintingDoubleBuffered, listenerList, maximumSize, minimumSize, opaque, preferredSize, requestFocusEnabled, TOOL_TIP_TEXT_KEY, toolTipText, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JTextField()
Creates a new instance of JTextField. |
|
JTextField(javax.swing.text.Document doc,
java.lang.String text,
int columns)
Creates a new instance of JTextField. |
|
JTextField(int columns)
Creates a new instance of JTextField. |
|
JTextField(java.lang.String text)
Creates a new instance of JTextField. |
|
JTextField(java.lang.String text,
int columns)
Creates a new instance of JTextField. |
|
| Method Summary | |
void |
addActionListener(java.awt.event.ActionListener listener)
Adds a new listener object to this text field. |
protected void |
configurePropertiesFromAction(Action action)
|
protected java.beans.PropertyChangeListener |
createActionPropertyChangeListener(Action action)
|
protected javax.swing.text.Document |
createDefaultModel()
Creates the default model for this text field. |
protected void |
fireActionPerformed()
Sends an action event to all registered ActionListener objects. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Returns the accessible context associated with the JTextField. |
Action |
getAction()
|
java.awt.event.ActionListener[] |
getActionListeners()
Returns all registered ActionListener objects. |
Action[] |
getActions()
Returns the set of Actions that are commands for the editor. |
int |
getColumns()
Returns the number of columns of this text field. |
protected int |
getColumnWidth()
Returns the column width, which is the width of the character m for the font in use. |
int |
getHorizontalAlignment()
Returns the horizontal alignment, which is one of: JTextField.LEFT, JTextField.CENTER, JTextField.RIGHT, JTextField.LEADING, JTextField.TRAILING. |
BoundedRangeModel |
getHorizontalVisibility()
Returns the bounded range model that describes the horizontal visibility of the text field in the case when the text does not fit into the available space. |
java.awt.Dimension |
getPreferredSize()
Returns the preferred size. |
int |
getScrollOffset()
Returns the scroll offset in pixels. |
java.lang.String |
getUIClassID()
Returns the class ID for the UI. |
boolean |
isValidateRoot()
Returns true, unless this is embedded in a
JViewport in which case the viewport takes responsibility of
validating. |
void |
postActionEvent()
|
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes a listener object from this text field. |
void |
scrollRectToVisible(java.awt.Rectangle r)
Calls scrollRectToVisible on the component's parent. |
void |
setAction(Action newAction)
|
void |
setActionCommand(java.lang.String command)
Sets the command string used in action events. |
void |
setColumns(int columns)
Sets the number of columns and then invalidates the layout. |
void |
setDocument(javax.swing.text.Document doc)
Sets the document to be used for this JTextField. |
void |
setFont(java.awt.Font newFont)
Sets the current font and revalidates so the font will take effect. |
void |
setHorizontalAlignment(int newAlign)
Sets the horizontal alignment of the text. |
void |
setScrollOffset(int offset)
Sets the scroll offset in pixels. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
actions
private static final Action[] actions
notifyAction
public static final java.lang.String notifyAction
- Name of the action that gets sent when the content of the text field
gets accepted.
- See Also:
- Constant Field Values
columns
private int columns
align
private int align
action
private Action action
- Since:
- 1.3
actionCommand
private java.lang.String actionCommand
- Since:
- 1.3
actionPropertyChangeListener
private java.beans.PropertyChangeListener actionPropertyChangeListener
horizontalVisibility
private BoundedRangeModel horizontalVisibility
- The horizontal visibility of the textfield.
| Constructor Detail |
JTextField
public JTextField()
- Creates a new instance of
JTextField.
JTextField
public JTextField(java.lang.String text)
- Creates a new instance of
JTextField.
JTextField
public JTextField(int columns)
- Creates a new instance of
JTextField.
JTextField
public JTextField(java.lang.String text, int columns)
- Creates a new instance of
JTextField.
JTextField
public JTextField(javax.swing.text.Document doc, java.lang.String text, int columns)
- Creates a new instance of
JTextField.
| Method Detail |
createDefaultModel
protected javax.swing.text.Document createDefaultModel()
- Creates the default model for this text field.
This implementation returns an instance of
PlainDocument.
setDocument
public void setDocument(javax.swing.text.Document doc)
- Sets the document to be used for this JTextField.
This sets the document property
filterNewlinestotrueand then calls the super behaviour to setup a view and revalidate the text field.
getUIClassID
public java.lang.String getUIClassID()
- Returns the class ID for the UI.
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
- Adds a new listener object to this text field.
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
- Removes a listener object from this text field.
getActionListeners
public java.awt.event.ActionListener[] getActionListeners()
- Returns all registered
ActionListenerobjects.- Since:
- 1.4
fireActionPerformed
protected void fireActionPerformed()
- Sends an action event to all registered
ActionListenerobjects.
getColumns
public int getColumns()
- Returns the number of columns of this text field.
setColumns
public void setColumns(int columns)
- Sets the number of columns and then invalidates the layout.
getHorizontalAlignment
public int getHorizontalAlignment()
- Returns the horizontal alignment, which is one of: JTextField.LEFT,
JTextField.CENTER, JTextField.RIGHT, JTextField.LEADING,
JTextField.TRAILING.
setHorizontalAlignment
public void setHorizontalAlignment(int newAlign)
- Sets the horizontal alignment of the text. Calls invalidate and repaint
and fires a property change event.
setFont
public void setFont(java.awt.Font newFont)
- Sets the current font and revalidates so the font will take effect.
- Overrides:
setFontin classJComponent
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Returns the preferred size. If there is a non-zero number of columns,
this is the number of columns multiplied by the column width, otherwise
it returns super.getPreferredSize().
- Overrides:
getPreferredSizein classJComponent
getScrollOffset
public int getScrollOffset()
- Returns the scroll offset in pixels.
setScrollOffset
public void setScrollOffset(int offset)
- Sets the scroll offset in pixels.
getActions
public Action[] getActions()
- Returns the set of Actions that are commands for the editor.
This is the actions supported by this editor plus the actions
of the UI (returned by JTextComponent.getActions()).
postActionEvent
public void postActionEvent()
getAction
public Action getAction()
- Since:
- 1.3
setAction
public void setAction(Action newAction)
- Since:
- 1.3
setActionCommand
public void setActionCommand(java.lang.String command)
- Sets the command string used in action events.
- Since:
- 1.3
createActionPropertyChangeListener
protected java.beans.PropertyChangeListener createActionPropertyChangeListener(Action action)
- Since:
- 1.3
configurePropertiesFromAction
protected void configurePropertiesFromAction(Action action)
- Since:
- 1.3
getColumnWidth
protected int getColumnWidth()
- Returns the column width, which is the width of the character m
for the font in use.
getAccessibleContext
public javax.accessibility.AccessibleContext getAccessibleContext()
- Returns the accessible context associated with the
JTextField.- Specified by:
getAccessibleContextin interfacejavax.accessibility.Accessible
getHorizontalVisibility
public BoundedRangeModel getHorizontalVisibility()
- Returns the bounded range model that describes the horizontal visibility
of the text field in the case when the text does not fit into the
available space. The actual values of this model are managed by the look
and feel implementation.
isValidateRoot
public boolean isValidateRoot()
- Returns
true, unless this is embedded in aJViewportin which case the viewport takes responsibility of validating.- Overrides:
isValidateRootin classJComponent
scrollRectToVisible
public void scrollRectToVisible(java.awt.Rectangle r)
- Description copied from class:
JComponent - Calls
scrollRectToVisibleon the component's parent. Components which can service this call should override.- Overrides:
scrollRectToVisiblein classJComponent
|
|||||||||
| Home >> All >> javax >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC