SWING - JTextBox

extended byjava.awt.Component
extended byjava.awt.Container
extended byjavax.swing.JComponent
extended byjavax.swing.text.JTextComponent
extended byjavax.swing.JTextField
Constructor Summary
Constructs a new TextField.
JTextField(Document doc, String text, int columns)
Constructs a new JTextField that uses the given text storage model and the given number of columns.
JTextField(int columns)
Constructs a new empty TextField with the specified number of columns.
JTextField(String text)
Constructs a new TextField initialized with the specified text.
JTextField(String text, int columns)
Constructs a new TextField initialized with the specified text and columns.

Method Summary
void addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this textfield.
protected void configurePropertiesFromAction(Action a)
Factory method which sets the ActionEvent source's properties according to values from the Action instance.
protected PropertyChangeListener createActionPropertyChangeListener(Action a)
Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.
protected Document createDefaultModel()
Creates the default implementation of the model to be used at construction if one isn't explicitly given.
protected void fireActionPerformed()
Notifies all listeners that have registered interest for notification on this event type.
AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JTextField.
Action getAction()
Returns the currently set Action for this ActionEvent source, or null if no Action is set.
ActionListener[] getActionListeners()
Returns an array of all the ActionListeners added to this JTextField with addActionListener().
Action[] getActions()
Fetches the command list for the editor.
int getColumns()
Returns the number of columns in this TextField.
protected int getColumnWidth()
Returns the column width.
int getHorizontalAlignment()
Returns the horizontal alignment of the text.
BoundedRangeModel getHorizontalVisibility()
Gets the visibility of the text field.
Dimension getPreferredSize()
Returns the preferred size Dimensions needed for this TextField.
int getScrollOffset()
Gets the scroll offset, in pixels.
String getUIClassID()
Gets the class ID for a UI.
boolean isValidateRoot()
Calls to revalidate that come from within the textfield itself will be handled by validating the textfield, unless the textfield is contained within a JViewport, in which case this returns false.
protected String paramString()
Returns a string representation of this JTextField.
void postActionEvent()
Processes action events occurring on this textfield by dispatching them to any registered ActionListener objects.
void removeActionListener(ActionListener l)
Removes the specified action listener so that it no longer receives action events from this textfield.
void scrollRectToVisible(Rectangle r)
Scrolls the field left or right.
void setAction(Action a)
Sets the Action for the ActionEvent source.
void setActionCommand(String command)
Sets the command string used for action events.
void setColumns(int columns)
Sets the number of columns in this TextField, and then invalidate the layout.
void setDocument(Document doc)
Associates the editor with a text document.
void setFont(Font f)
Sets the current font.
void setHorizontalAlignment(int alignment)
Sets the horizontal alignment of the text.
void setScrollOffset(int scrollOffset)
Sets the scroll offset, in pixels.


import java.awt.*;
import javax.swing.*;

public class jtextbox extends JApplet{
JTextField text= new JTextField(18);

public jtextbox() {
Container frame = getContentPane();
frame.setLayout(new FlowLayout());
text.setText("Hellow From Java");