Java Reference
In-Depth Information
TABLE 12-8 Commonly Used Constructors and Methods of the class JTextArea
public JTextArea( int r, int c)
//Constructor
//Creates a new JTextArea with r number of rows and
//c number of columns.
public JTextArea(String t, int r, int c)
//Constructor
//Creates a new JTextArea with r number of rows, c number
//of columns, and the initial text t.
public void setColumns( int c)
//Sets the number of columns to c.
public void setRows( int r)
//Sets the number of rows to r.
public void append(String t)
//Concatenates the text already in the JTextArea with t.
public void setLineWrap( boolean b)
//If b is true, the lines are wrapped.
public void setTabSize( int c)
//Sets tab stops every c columns.
public void setWrapStyleWord( boolean b)
//If b is true, the lines are wrapped at the word boundaries.
//If b is false, the word boundaries are not considered.
Table 12-9 shows the methods, which you have used with a JTextField object, that are
inherited by the class JTextArea from the parent class JTextComponent .
TABLE 12-9 Methods Inherited by the class JTextArea from the Parent class
JTextComponent
public void setText(String t)
//Changes the text of the text area to t.
public String getText()
//Returns the text contained in the text area.
public void setEditable( boolean b)
//If b is false, the user cannot type in the text area. In this case,
//the text area is used as a tool to display the result.
Search WWH ::




Custom Search