buoy.widget
Class BTextArea
A BTextArea is a multi-line text entry box. You can specify a preferred size for the text area in terms
of rows and columns, but it automatically expands to be large enough to show all text contained in it.
Usually, a BTextArea is used inside a BScrollPane. The settings for numbers of rows and columns are then
treated as the preferred size of the visible area, and the scroll bars can be used to scroll through
the text.
In addition to the event types generated by all Widgets, BTextAreas generate the following event types:
BTextArea() - Create an empty BTextArea whose preferred numbers of rows and columns are 0.
|
BTextArea(String text) - Create a new BTextArea whose preferred numbers of rows and columns are 0.
|
BTextArea(String text, int rows, int columns) - Create a new BTextArea.
|
BTextArea(int rows, int columns) - Create an empty BTextArea.
|
void | append(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.
|
JTextArea | getComponent()
|
int | getLineCount() - Determine the number of lines of text contained in this text area.
|
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(String text, int pos) - Insert a String into the middle of the text contained in this Widget.
|
void | replaceRange(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 , getComponent , getLength , getSelectedText , getSelectionEnd , getSelectionStart , getText , isEditable , setCaretPosition , setEditable , setSelectionEnd , setSelectionStart , setText |
addEventLink , dispatchEvent , getBackground , getBounds , getComponent , getCursor , getFont , getMaximumSize , getMinimumSize , getName , getParent , getPreferredSize , hasFocus , isEnabled , isFocusable , isVisible , repaint , requestFocus , setBackground , setCursor , setEnabled , setFocusable , setFont , setName , setVisible |
BTextArea
public BTextArea()
Create an empty BTextArea whose preferred numbers of rows and columns are 0.
BTextArea
public BTextArea(String text)
Create a new BTextArea whose preferred numbers of rows and columns are 0.
text
- the initial text contained in the text area (may be null)
BTextArea
public BTextArea(String text,
int rows,
int columns)
Create a new BTextArea.
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 display
BTextArea
public BTextArea(int rows,
int columns)
Create an empty BTextArea.
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 display
append
public void append(String text)
Append a String to the text contained in this Widget.
This method can be safely called from any thread, not just the event dispatch thread.
text
- the text to append
getColumns
public int getColumns()
Get the number of columns this text area should be wide enough to display.
getLineCount
public int getLineCount()
Determine the number of lines of text contained in this text area.
getMinimumSize
public Dimension getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out
its contents, it will attempt never to make this Widget smaller than its minimum size.
- getMinimumSize in interface Widget
getRows
public int getRows()
Get the number of rows this text area should be tall enough to display.
getTabSize
public int getTabSize()
Get the number of character widths to use for a tab character.
getWrapStyle
public BTextArea.WrapStyle getWrapStyle()
Get the line wrap style for this text area. This will be equal to WRAP_NONE, WRAP_CHARACTER,
or WRAP_WORD.
insert
public void insert(String text,
int pos)
Insert a String into the middle of the text contained in this Widget.
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 it
replaceRange
public void replaceRange(String text,
int start,
int end)
Replace a part of the text contained in this Widget with a new String.
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 replace
setColumns
public void setColumns(int columns)
Set the number of columns this text area should be wide enough to display.
setRows
public void setRows(int rows)
Set the number of rows this text area should be tall enough to display.
setTabSize
public void setTabSize(int size)
Set the number of character widths to use for a tab character.
setWrapStyle
public void setWrapStyle(BTextArea.WrapStyle style)
Set the line wrap style for this text area. This should be equal to WRAP_NONE, WRAP_CHARACTER,
or WRAP_WORD.
Written by Peter Eastman.