public class TextField extends TextComponent
TextField
TextField tf1, tf2, tf3, tf4; // a blank text field tf1 = new TextField(); // blank field of 20 columns tf2 = new TextField("", 20); // predefined text displayed tf3 = new TextField("Hello!"); // predefined text in 30 columns tf4 = new TextField("Hello", 30);
|
|
---|---|
|
|
TextComponent.AccessibleAWTTextComponent
Component.AccessibleAWTComponent , Component.BaselineResizeBehavior , Component.BltBufferStrategy , Component.FlipBufferStrategy
textListener
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH
|
---|
|
|
|
|
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addTextListener , enableInputMethods , getBackground , getCaretPosition , getInputMethodRequests , getSelectedText , getSelectionEnd , getSelectionStart , getText , getTextListeners , isEditable , processTextEvent , removeNotify , removeTextListener , select , selectAll , setBackground , setCaretPosition , setEditable , setSelectionEnd , setSelectionStart
action , add , addComponentListener , addFocusListener , addHierarchyBoundsListener , addHierarchyListener , addInputMethodListener , addKeyListener , addMouseListener , addMouseMotionListener , addMouseWheelListener , addPropertyChangeListener , addPropertyChangeListener , applyComponentOrientation , areFocusTraversalKeysSet , bounds , checkImage , checkImage , coalesceEvents , contains , contains , createImage , createImage , createVolatileImage , createVolatileImage , deliverEvent , disable , disableEvents , dispatchEvent , doLayout , enable , enable , enableEvents , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , getAlignmentX , getAlignmentY , getBaseline , getBaselineResizeBehavior , getBounds , getBounds , getColorModel , getComponentAt , getComponentAt , getComponentListeners , getComponentOrientation , getCursor , getDropTarget , getFocusCycleRootAncestor , getFocusListeners , getFocusTraversalKeys , getFocusTraversalKeysEnabled , getFont , getFontMetrics , getForeground , getGraphics , getGraphicsConfiguration , getHeight , getHierarchyBoundsListeners , getHierarchyListeners , getIgnoreRepaint , getInputContext , getInputMethodListeners , getKeyListeners , getLocale , getLocation , getLocation , getLocationOnScreen , getMaximumSize , getMouseListeners , getMouseMotionListeners , getMousePosition , getMouseWheelListeners , getName , getParent , getPeer , getPropertyChangeListeners , getPropertyChangeListeners , getSize , getSize , getToolkit , getTreeLock , getWidth , getX , getY , gotFocus , handleEvent , hasFocus , hide , imageUpdate , inside , invalidate , isBackgroundSet , isCursorSet , isDisplayable , isDoubleBuffered , isEnabled , isFocusable , isFocusCycleRoot , isFocusOwner , isFocusTraversable , isFontSet , isForegroundSet , isLightweight , isMaximumSizeSet , isMinimumSizeSet , isOpaque , isPreferredSizeSet , isShowing , isValid , isVisible , keyDown , keyUp , layout , list , list , list , list , list , locate , location , lostFocus , mouseDown , mouseDrag , mouseEnter , mouseExit , mouseMove , mouseUp , move , nextFocus , paint , paintAll , postEvent , prepareImage , prepareImage , print , printAll , processComponentEvent , processFocusEvent , processHierarchyBoundsEvent , processHierarchyEvent , processInputMethodEvent , processKeyEvent , processMouseEvent , processMouseMotionEvent , processMouseWheelEvent , remove , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removePropertyChangeListener , removePropertyChangeListener , repaint , repaint , repaint , repaint , requestFocus , requestFocus , requestFocusInWindow , requestFocusInWindow , reshape , resize , resize , revalidate , setBounds , setBounds , setComponentOrientation , setCursor , setDropTarget , setEnabled , setFocusable , setFocusTraversalKeys , setFocusTraversalKeysEnabled , setFont , setForeground , setIgnoreRepaint , setLocale , setLocation , setLocation , setMaximumSize , setMinimumSize , setName , setPreferredSize , setSize , setSize , setVisible , show , show , size , toString , transferFocus , transferFocusBackward , transferFocusUpCycle , update , validate
public TextField() throws HeadlessException
HeadlessException
GraphicsEnvironment.isHeadless()
public TextField( String text) throws HeadlessException
text
text
null
""
HeadlessException
GraphicsEnvironment.isHeadless()
public TextField(int columns) throws HeadlessException
columns
columns
zero
columns
zero
HeadlessException
GraphicsEnvironment.isHeadless()
public TextField( String text, int columns) throws HeadlessException
text
text
null
""
columns
columns
zero
columns
zero
HeadlessException
GraphicsEnvironment.isHeadless()
public void addNotify()
addNotify
TextComponent
TextComponent.removeNotify()
public char getEchoChar()
echoCharIsSet()
setEchoChar(char)
public void setEchoChar(char c)
c
echoCharIsSet()
getEchoChar()
@Deprecated public void setEchoCharacter(char c)
setEchoChar(char)
public void setText( String t)
setText
TextComponent
t
TextComponent.getText()
public boolean echoCharIsSet()
true
false
setEchoChar(char)
getEchoChar()
public int getColumns()
setColumns(int)
public void setColumns(int columns)
columns
IllegalArgumentException
columns
zero
getColumns()
public Dimension getPreferredSize(int columns)
columns
@Deprecated public Dimension preferredSize(int columns)
getPreferredSize(int)
public Dimension getPreferredSize()
getPreferredSize
Component
Component.getMinimumSize()
LayoutManager
@Deprecated public Dimension preferredSize()
getPreferredSize()
preferredSize
Component
public Dimension getMinimumSize(int columns)
columns
@Deprecated public Dimension minimumSize(int columns)
getMinimumSize(int)
public Dimension getMinimumSize()
getMinimumSize
Component
Component.getPreferredSize()
LayoutManager
@Deprecated public Dimension minimumSize()
getMinimumSize()
minimumSize
Component
public void addActionListener( ActionListener l)
l
removeActionListener(java.awt.event. ActionListener)
getActionListeners()
ActionListener
public void removeActionListener( ActionListener l)
l
addActionListener(java.awt.event. ActionListener)
getActionListeners()
ActionListener
public ActionListener [] getActionListeners()
ActionListener
addActionListener(java.awt.event. ActionListener)
removeActionListener(java.awt.event. ActionListener)
java.awt.event
public <T extends EventListener > T[] getListeners( Class <T> listenerType)
Foo Listener
TextField
Foo Listener
add Foo Listener
ActionListener[] als = (ActionListener[])(t.getListeners(ActionListener.class));
getListeners
TextComponent
listenerType
java.util.EventListener
Foo Listener
ClassCastException
listenerType
java.util.EventListener
getActionListeners()
protected void processEvent( AWTEvent e)
ActionEvent
processActionEvent
processEvent
processEvent
TextComponent
e
ActionEvent
processActionEvent(java.awt.event. ActionEvent)
protected void processActionEvent( ActionEvent e)
ActionListener
ActionListener
addActionListener
enableEvents
e
ActionListener
addActionListener(java.awt.event. ActionListener)
Component.enableEvents(long)
protected String paramString()
TextField
null
paramString
TextComponent
public AccessibleContext getAccessibleContext()
getAccessibleContext
Accessible
getAccessibleContext
TextComponent