java.awt
Class TextField
- Accessible, ImageObserver, MenuContainer, Serializable
This class implements a single line text entry field widget
TextField() - Initializes a new instance of
TextField that is empty
and has one column.
|
TextField(int columns) - Initializes a new instance of
TextField that is empty
and has the specified number of columns.
|
TextField(String text) - Initializes a new instance of
TextField containing
the specified text.
|
TextField(String text, int columns) - Initializes a new instance of
TextField with the
specified text and number of columns.
|
addTextListener , extends EventListener> T[] getListeners , getAccessibleContext , getCaretPosition , getSelectedText , getSelectionEnd , getSelectionStart , getText , getTextListeners , isEditable , paramString , processEvent , processTextEvent , removeNotify , removeTextListener , select , selectAll , setCaretPosition , setEditable , setSelectionEnd , setSelectionStart , setText |
action , add , addComponentListener , addFocusListener , addHierarchyBoundsListener , addHierarchyListener , addInputMethodListener , addKeyListener , addMouseListener , addMouseMotionListener , addMouseWheelListener , addNotify , addPropertyChangeListener , addPropertyChangeListener , applyComponentOrientation , areFocusTraversalKeysSet , bounds , checkImage , checkImage , coalesceEvents , contains , contains , createImage , createImage , createVolatileImage , createVolatileImage , deliverEvent , disable , disableEvents , dispatchEvent , doLayout , enable , enable , enableEvents , enableInputMethods , extends EventListener> T[] getListeners , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , getAccessibleContext , getAlignmentX , getAlignmentY , getBackground , getBounds , getBounds , getColorModel , getComponentAt , getComponentAt , getComponentListeners , getComponentOrientation , getCursor , getDropTarget , getFocusCycleRootAncestor , getFocusListeners , getFocusTraversalKeys , getFocusTraversalKeysEnabled , getFont , getFontMetrics , getForeground , getGraphics , getGraphicsConfiguration , getHeight , getHierarchyBoundsListeners , getHierarchyListeners , getIgnoreRepaint , getInputContext , getInputMethodListeners , getInputMethodRequests , getKeyListeners , getLocale , getLocation , getLocation , getLocationOnScreen , getMaximumSize , getMinimumSize , getMouseListeners , getMouseMotionListeners , getMouseWheelListeners , getName , getParent , getPeer , getPreferredSize , getPropertyChangeListeners , getPropertyChangeListeners , getSize , getSize , getToolkit , getTreeLock , getWidth , getX , getY , gotFocus , handleEvent , hasFocus , hide , imageUpdate , inside , invalidate , isBackgroundSet , isCursorSet , isDisplayable , isDoubleBuffered , isEnabled , isFocusCycleRoot , isFocusOwner , isFocusTraversable , isFocusable , isFontSet , isForegroundSet , isLightweight , isMaximumSizeSet , isMinimumSizeSet , isOpaque , isPreferredSizeSet , isShowing , isValid , isVisible , keyDown , keyUp , layout , list , list , list , list , list , locate , location , lostFocus , minimumSize , mouseDown , mouseDrag , mouseEnter , mouseExit , mouseMove , mouseUp , move , nextFocus , paint , paintAll , paramString , postEvent , preferredSize , prepareImage , prepareImage , print , printAll , processComponentEvent , processEvent , processFocusEvent , processHierarchyBoundsEvent , processHierarchyEvent , processInputMethodEvent , processKeyEvent , processMouseEvent , processMouseMotionEvent , processMouseWheelEvent , remove , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removeNotify , removePropertyChangeListener , removePropertyChangeListener , repaint , repaint , repaint , repaint , requestFocus , requestFocus , requestFocusInWindow , requestFocusInWindow , reshape , resize , resize , setBackground , setBounds , setBounds , setComponentOrientation , setCursor , setDropTarget , setEnabled , setFocusTraversalKeys , setFocusTraversalKeysEnabled , setFocusable , setFont , setForeground , setIgnoreRepaint , setLocale , setLocation , setLocation , setMaximumSize , setMinimumSize , setName , setPreferredSize , setSize , setSize , setVisible , show , show , size , toString , transferFocus , transferFocusBackward , transferFocusUpCycle , update , validate |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
TextField
public TextField()
Initializes a new instance of TextField
that is empty
and has one column.
TextField
public TextField(int columns)
Initializes a new instance of TextField
that is empty
and has the specified number of columns.
columns
- The number of columns in the text field.
TextField
public TextField(String text)
Initializes a new instance of TextField
containing
the specified text. The number of columns will be equal to the
length of the text string.
text
- The text to display in the field.
TextField
public TextField(String text,
int columns)
Initializes a new instance of TextField
with the
specified text and number of columns.
text
- The text to display in the field.columns
- The number of columns in the field.
addActionListener
public void addActionListener(ActionListener listener)
Addes a new listener to the list of action listeners for this
object.
listener
- The listener to add to the list.
echoCharIsSet
public boolean echoCharIsSet()
Tests whether or not this text field has an echo character set
so that characters the user type are not echoed to the screen.
true
if an echo character is set,
false
otherwise.
extends EventListener> T[] getListeners
public extends EventListener> T[] getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this TextField
. FooListeners are registered using the
addFooListener method.
- extends EventListener> T[] getListeners in interface TextComponent
ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.
getColumns
public int getColumns()
Returns the number of columns in the field.
- The number of columns in the field.
getEchoChar
public char getEchoChar()
Returns the character that is echoed to the screen when a text
field is protected (such as when a password is being entered).
- The echo character for this text field.
getMinimumSize
public Dimension getMinimumSize(int columns)
Returns the minimum size of a text field with the specified number
of columns.
columns
- The number of columns to get the minimum size for.
getPreferredSize
public Dimension getPreferredSize(int columns)
Returns the preferred size of a text field with the specified number
of columns.
columns
- The number of columns to get the preferred size for.
minimumSize
public Dimension minimumSize()
This method is deprecated in favor of
getMinimumSize()
.
Returns the minimum size for this text field.
- minimumSize in interface Component
- The minimum size for this text field.
minimumSize
public Dimension minimumSize(int columns)
This method is deprecated in favor of
getMinimumSize(int)
.
Returns the minimum size of a text field with the specified number
of columns.
columns
- The number of columns to get the minimum size for.
preferredSize
public Dimension preferredSize()
This method is deprecated in favor of
getPreferredSize()
.
Returns the preferred size for this text field.
- preferredSize in interface Component
- The preferred size for this text field.
preferredSize
public Dimension preferredSize(int columns)
This method is deprecated in favor of
getPreferredSize(int)
.
Returns the preferred size of a text field with the specified number
of columns.
columns
- The number of columns to get the preferred size for.
processActionEvent
protected void processActionEvent(ActionEvent event)
Processes an action event by calling any registered listeners.
Note to subclasses: This method is not called unless action events
are enabled on this object. This will be true if any listeners
are registered, or if action events were specifically enabled
using enableEvents()
.
event
- The event to process.
processEvent
protected void processEvent(AWTEvent event)
Processes the specified event. If the event is an instance of
ActionEvent
then processActionEvent()
is
called to process it, otherwise the event is sent to the
superclass.
- processEvent in interface TextComponent
event
- The event to process.
removeActionListener
public void removeActionListener(ActionListener listener)
Removes the specified listener from the list of action listeners
for this object.
listener
- The listener to remove from the list.
setColumns
public void setColumns(int columns)
Sets the number of columns in this field to the specified value.
columns
- The new number of columns in the field.
setEchoChar
public void setEchoChar(char echoChar)
Sets the character that is echoed when protected input such as
a password is displayed.
echoChar
- The new echo character.
setEchoCharacter
public void setEchoCharacter(char echoChar)
This method is deprecated in favor of
setEchoChar()
Sets the character that is echoed when protected input such as
a password is displayed.
echoChar
- The new echo character.
TextField.java -- A one line text entry field
Copyright (C) 1999, 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.