|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.text.JTextComponent javax.swing.JTextArea com.jidesoft.swing.AutoResizingTextArea
public class AutoResizingTextArea
An extended version of JTextArea
that automatically resizes itself vertically. This component works best
when used in a layout that obeys preferred height of its components. For example, you can use a
BorderLayout
and place AutoResizingTextArea
to the north or south side. Similarly, you can
use a JideBoxLayout
and use FLEXIBLE or FIX as the constraint.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTextArea |
---|
JTextArea.AccessibleJTextArea |
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
---|
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
DEFAULT_MAX_ROWS
Default maximum height of the text area in rows. |
static int |
DEFAULT_MIN_ROWS
Default minimum height of the text area in rows. |
Fields inherited from class javax.swing.text.JTextComponent |
---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
AutoResizingTextArea()
Creates a textarea with the default minimum and maximum number of rows. |
|
AutoResizingTextArea(Document doc)
Create a new AutoResizingTextArea using a Document . |
|
AutoResizingTextArea(Document doc,
String text,
int minRows,
int maxRows,
int columns)
Constructs a new AutoResizingTextArea with the specified number of rows and columns, and the given
model. |
|
AutoResizingTextArea(int minRows)
Creates a textarea with the specified minimum number of rows. |
|
AutoResizingTextArea(int minRows,
int maxRows)
Creates a textarea with the specified minimum and maximum number of rows. |
|
AutoResizingTextArea(int minRows,
int maxRows,
int columns)
Create a new AutoResizingTextArea with a height bounded by the provided minimum and maximum row
counts and with its width dictated by the provided column count. |
|
AutoResizingTextArea(String text)
Creates a textarea with the default minimum and maximum row count and the provided initial text. |
|
AutoResizingTextArea(String text,
int minRows,
int maxRows,
int columns)
Create a new AutoResizingTextArea with a height bounded by the provided minimum and maximum row
counts and with its width dictated by the provided column count. |
Method Summary | |
---|---|
int |
getMaxRows()
Gets the maximum number of rows that will be displayed. |
int |
getMinRows()
Gets the minimum number of rows that will be displayed. |
Dimension |
getPreferredScrollableViewportSize()
|
protected void |
numberOfRowsUpdated(int oldRow,
int newRow)
Called when the number of rows is updated. |
void |
setDocument(Document doc)
|
void |
setMaxRows(int maxRows)
Sets the maximum number of rows that will be displayed. |
void |
setMinRows(int minRows)
Sets the minimum number of rows that will be displayed |
void |
setRows(int rows)
Sets the number of visible rows. |
Methods inherited from class javax.swing.JTextArea |
---|
append, createDefaultModel, getAccessibleContext, getColumns, getColumnWidth, getLineCount, getLineEndOffset, getLineOfOffset, getLineStartOffset, getLineWrap, getPreferredSize, getRowHeight, getRows, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getTabSize, getUIClassID, getWrapStyleWord, insert, paramString, replaceRange, setColumns, setFont, setLineWrap, setTabSize, setWrapStyleWord |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_ROWS
public static final int DEFAULT_MIN_ROWS
Constructor Detail |
---|
public AutoResizingTextArea()
public AutoResizingTextArea(int minRows)
minRows
- The minimum number of rows that this textarea can have.public AutoResizingTextArea(int minRows, int maxRows)
minRows
- The minimum number of rows that this textarea can have.maxRows
- The maximum number of rows that this textarea can have.public AutoResizingTextArea(String text)
text
- The initial text to display.public AutoResizingTextArea(int minRows, int maxRows, int columns)
AutoResizingTextArea
with a height bounded by the provided minimum and maximum row
counts and with its width dictated by the provided column count.
minRows
- The minimum number of rows that this textarea can havemaxRows
- The maximum number of rows that this textarea can have.columns
- The number of columns that this textarea has.public AutoResizingTextArea(String text, int minRows, int maxRows, int columns)
AutoResizingTextArea
with a height bounded by the provided minimum and maximum row
counts and with its width dictated by the provided column count. The textarea is sized to fit the provided text.
text
- The initial text to display in the textarea.minRows
- The minimum number of rows that this textarea can havemaxRows
- The maximum number of rows that this textarea can have.columns
- The number of columns that this textarea has.
IllegalArgumentException
- if the rows or columns arguments are negative.public AutoResizingTextArea(Document doc)
AutoResizingTextArea
using a Document
. The document will be set to the
text area using setDocument(javax.swing.text.Document)
.
doc
- the document.public AutoResizingTextArea(Document doc, String text, int minRows, int maxRows, int columns)
AutoResizingTextArea
with the specified number of rows and columns, and the given
model. All of the constructors feed through this constructor.
doc
- the model to use, or create a default one if nulltext
- the text to be displayed, null if noneminRows
- the minimum number of rows >= 0maxRows
- the maximum number of rows >= 0columns
- the number of columns >= 0
IllegalArgumentException
- if the rows or columns arguments are negative.Method Detail |
---|
public void setRows(int rows)
setRows
in class JTextArea
rows
- The number of rows to showprotected void numberOfRowsUpdated(int oldRow, int newRow)
oldRow
- the previous row count.newRow
- the new row count.public int getMaxRows()
setMaxRows(int)
or passed
in using constructor such as AutoResizingTextArea(int, int)
.
public void setMaxRows(int maxRows)
maxRows
- The maximum number of rows.public int getMinRows()
setMinRows(int)
or passed
in using constructor such as AutoResizingTextArea(int, int)
.
public void setMinRows(int minRows)
minRows
- The minimum number of rows.public void setDocument(Document doc)
setDocument
in class JTextComponent
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
getPreferredScrollableViewportSize
in class JTextArea
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |