public class BTextArea extends TextWidget
In addition to the event types generated by all Widgets, BTextAreas generate the following event types:
Modifier and Type | Class and Description |
---|---|
static class |
BTextArea.WrapStyle
This inner class represents a wrapping style.
|
Modifier and Type | Field and Description |
---|---|
static BTextArea.WrapStyle |
WRAP_CHARACTER |
static BTextArea.WrapStyle |
WRAP_NONE |
static BTextArea.WrapStyle |
WRAP_WORD |
Constructor and Description |
---|
BTextArea()
Create an empty BTextArea whose preferred numbers of rows and columns are 0.
|
BTextArea(int rows,
int columns)
Create an empty BTextArea.
|
BTextArea(java.lang.String text)
Create a new BTextArea whose preferred numbers of rows and columns are 0.
|
BTextArea(java.lang.String text,
int rows,
int columns)
Create a new BTextArea.
|
Modifier and Type | Method and Description |
---|---|
void |
append(java.lang.String text)
Append a String to the text contained in this Widget.
|
int |
getColumns()
Get the number of columns this text area should be wide enough to display.
|
javax.swing.JTextArea |
getComponent()
Get the java.awt.Component corresponding to this Widget.
|
int |
getLineCount()
Determine the number of lines of text contained in this text area.
|
java.awt.Dimension |
getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn.
|
int |
getRows()
Get the number of rows this text area should be tall enough to display.
|
int |
getTabSize()
Get the number of character widths to use for a tab character.
|
BTextArea.WrapStyle |
getWrapStyle()
Get the line wrap style for this text area.
|
void |
insert(java.lang.String text,
int pos)
Insert a String into the middle of the text contained in this Widget.
|
void |
replaceRange(java.lang.String text,
int start,
int end)
Replace a part of the text contained in this Widget with a new String.
|
void |
setColumns(int columns)
Set the number of columns this text area should be wide enough to display.
|
void |
setRows(int rows)
Set the number of rows this text area should be tall enough to display.
|
void |
setTabSize(int size)
Set the number of character widths to use for a tab character.
|
void |
setWrapStyle(BTextArea.WrapStyle style)
Set the line wrap style for this text area.
|
getCaretPosition, getLength, getSelectedText, getSelectionEnd, getSelectionStart, getText, isEditable, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart, setText
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMaximumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
addEventLink, addEventLink, removeEventLink
public static final BTextArea.WrapStyle WRAP_NONE
public static final BTextArea.WrapStyle WRAP_CHARACTER
public static final BTextArea.WrapStyle WRAP_WORD
public BTextArea()
public BTextArea(java.lang.String text)
text
- the initial text contained in the text area (may be null)public BTextArea(int rows, int columns)
rows
- the number of rows this text area should be tall enough to displaycolumns
- the number of columns this text area should be wide enough to displaypublic BTextArea(java.lang.String text, int rows, int columns)
text
- the initial text contained in the text area (may be null)rows
- the number of rows this text area should be tall enough to displaycolumns
- the number of columns this text area should be wide enough to displaypublic javax.swing.JTextArea getComponent()
Widget
getComponent
in class TextWidget
public int getRows()
public void setRows(int rows)
public int getColumns()
public void setColumns(int columns)
public int getLineCount()
public BTextArea.WrapStyle getWrapStyle()
public void setWrapStyle(BTextArea.WrapStyle style)
public int getTabSize()
public void setTabSize(int size)
public void append(java.lang.String text)
This method can be safely called from any thread, not just the event dispatch thread.
text
- the text to appendpublic void insert(java.lang.String text, int pos)
This method can be safely called from any thread, not just the event dispatch thread.
text
- the text to insertpos
- the position at which to insert itpublic void replaceRange(java.lang.String text, int start, int end)
This method can be safely called from any thread, not just the event dispatch thread.
text
- the new text with which to replace the specified rangestart
- the beginning of the range to replaceend
- the end of the range to replacepublic java.awt.Dimension getMinimumSize()
getMinimumSize
in class Widget
Written by Peter Eastman.