|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--dog.gui.DContainer | +--dog.gui.DTextComponent | +--dog.gui.DTextArea
A component that allows the editing of multiple lines of text.
You may specify an alignment (LEFT, CENTER, or RIGHT) for the text within the component.
You can choose a scrollbar displaying policy and whether or not to wrap lines. By default, a vertical scrollbar is used if required, and word wrap is on.
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected java.awt.event.ActionListener |
actionListener
|
protected int |
align
The alignment of the text. |
static int |
CENTER
The center alignment. |
protected int |
columns
The number of columns in the DTextArea. |
protected boolean |
filled
Is this component filled? |
protected boolean |
focus
Do we currently have the focus? |
protected DScrollbar |
horizontal
The horizontal scrollbar. |
static int |
LEFT
The left alignment. |
protected java.awt.Point |
pos
|
static int |
RIGHT
The right alignment. |
protected int |
rows
The number of rows in the DTextArea. |
static int |
SCROLLBARS_BOTH
Create and display both vertical and horizontal scrollbars. |
static int |
SCROLLBARS_HORIZONTAL_ONLY
Create and display horizontal scrollbar only. |
static int |
SCROLLBARS_NONE
Do not create or display any scrollbars for the text area. |
static int |
SCROLLBARS_VERTICAL_ONLY
Create and display vertical scrollbar only. |
protected int |
scrollbarVisibility
The scrollbar policy. |
protected java.awt.Point |
selEnd
|
protected java.awt.Point |
selStart
|
protected int |
tabWidth
Number of spaces to expand tabs to. |
protected java.lang.String[] |
textRows
|
protected DScrollbar |
vertical
The vertical scrollbar. |
Fields inherited from class dog.gui.DTextComponent |
editable, position, selectionEnd, selectionStart, text, textListener |
Fields inherited from class dog.gui.DContainer |
cancelButton, defaultButton, EAST, NORTH, NORTHEAST, NORTHWEST, reference, SOUTH, SOUTHEAST, SOUTHWEST, tooltip, WEST |
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 | |
DTextArea()
Constructs a new text area. |
|
DTextArea(java.lang.String text)
Constructs a new text area initialized with the specified text. |
|
DTextArea(java.lang.String text,
int align)
Constructs a new text area with the specified text and alignment. |
|
DTextArea(java.lang.String text,
int align,
int scrollbarVisibility)
Constructs a new text area with the specified text, alignment, and scrollbar policy. |
Method Summary | |
void |
addActionListener(java.awt.event.ActionListener listener)
Adds the specified action listener to receive action events from this component. |
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
A scrollbar was moved. |
void |
append(java.lang.String text)
Inserts the specified string at the end. |
void |
deleteLeft()
Deletes the character to the left of the caret. |
void |
deleteRight()
Deletes the character to the right of the caret. |
void |
deleteSelection()
Removes the selected text. |
void |
doLayout()
Lays out this area. |
int |
getAlign()
Returns the alignment of the text in this text area. |
int |
getCaretPosition()
Returns the position of the text insertion caret. |
java.awt.Point |
getCaretPositionPoint()
Returns the (x,y) coordinates of the text insertion caret. |
int |
getColumns()
Returns the number of columns in this text area. |
java.awt.Dimension |
getMinimumSize()
Returns the minimum size for this component. |
protected java.awt.Point |
getPoint(int offset)
Returns the coordinates represented by the specified text offset. |
java.awt.Dimension |
getPreferredSize()
Returns the preferred size for this component. |
int |
getRows()
Returns the number of rows in the text area. |
int |
getScrollbarVisibility()
Returns the scrollbar policy for this text area. |
int |
getSelectionEnd()
Returns the selected text's end position. |
java.awt.Point |
getSelectionEndPoint()
Returns the (x,y) coordinates of the selected text's end position. |
int |
getSelectionStart()
Returns the selected text's start position. |
java.awt.Point |
getSelectionStartPoint()
Returns the (x,y) coordinates of the selected text's start position. |
java.lang.String |
getText()
Returns the entire text of this text area as a String. |
void |
insert(char ch,
boolean selected)
Inserts the specified character at the current caret position. |
void |
insert(java.lang.String text,
boolean selected)
Inserts the specified string at the current caret position. |
boolean |
isFilled()
Indicates whether this component is filled. |
boolean |
isFocusTraversable()
This component is focus-traversable if it is not disabled. |
void |
moveDown(boolean selected)
Moves the caret down one line. |
void |
moveLeft(boolean selected)
Moves the caret one character left. |
void |
moveLineEnd(boolean selected)
Moves the caret to the end of the line. |
void |
moveLineStart(boolean selected)
Moves the caret to the start of the line. |
void |
moveRight(boolean selected)
Moves the caret one character right. |
void |
moveUp(boolean selected)
Moves the caret up one line. |
void |
moveWordLeft(boolean selected)
Moves the caret one word left. |
void |
moveWordRight(boolean selected)
Moves the caret one word right. |
void |
paint(java.awt.Graphics g)
Paints this view. |
protected java.lang.String |
paramString()
Returns a parameter string for this component. |
protected void |
processActionEvent(java.awt.event.ActionEvent event)
Processes action events occurring on this component by dispatching them to any registered ActionListener objects. |
protected void |
processEvent(java.awt.AWTEvent event)
Processes events on this component. |
protected void |
processFocusEvent(java.awt.event.FocusEvent event)
Process focus events. |
protected void |
processKeyEvent(java.awt.event.KeyEvent event)
Process key events. |
protected void |
processMouseEvent(java.awt.event.MouseEvent event)
Process mouse events. |
protected void |
processMouseMotionEvent(java.awt.event.MouseEvent event)
Process mouse motion events. |
void |
readFrom(java.io.Reader reader)
Reads into the textarea buffer from a Reader. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener so that it no longer receives action events from this component. |
void |
select(int selectionStart,
int selectionEnd)
Selects the text found between the specified start and end locations. |
void |
select(java.awt.Point selectionStart,
java.awt.Point selectionEnd)
Selects the text found between the specified start and end coordinates. |
void |
selectAll()
Selects all the text. |
void |
setAlign(int align)
Sets the alignment of the text in this text area. |
void |
setColumns(int columns)
Sets the number of columns for this text area. |
void |
setFilled(boolean filled)
Sets whether to fill this component with the fill colour. |
void |
setRows(int rows)
Sets the number of rows for this text area. |
void |
setScrollbarVisibility(int scrollbarVisibility)
Sets the scrollbar policy for this text area. |
void |
setSelectionEnd(int selectionEnd)
Sets the selection end to the specified position. |
void |
setSelectionStart(int selectionStart)
Sets the selection start to the specified position. |
void |
setText(java.lang.String text)
Sets the entire text of this text area. |
void |
timerFired(TimerEvent event)
The timer fired, blink the caret. |
void |
writeTo(java.io.Writer writer)
Writes the textarea buffer into a Writer. |
Methods inherited from class dog.gui.DTextComponent |
addTextListener, copySelection, cutSelection, getSelectedText, isEditable, lostOwnership, pasteSelection, processTextEvent, removeTextListener, setEditable |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addNotify, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int CENTER
public static final int LEFT
public static final int RIGHT
public static final int SCROLLBARS_NONE
public static final int SCROLLBARS_HORIZONTAL_ONLY
public static final int SCROLLBARS_VERTICAL_ONLY
public static final int SCROLLBARS_BOTH
protected int align
protected int scrollbarVisibility
protected boolean filled
protected int tabWidth
protected DScrollbar horizontal
protected DScrollbar vertical
protected transient boolean focus
protected transient java.awt.event.ActionListener actionListener
protected java.lang.String[] textRows
protected java.awt.Point selStart
protected java.awt.Point selEnd
protected java.awt.Point pos
protected int rows
protected int columns
Constructor Detail |
public DTextArea()
public DTextArea(java.lang.String text)
text
- the text to be displayedpublic DTextArea(java.lang.String text, int align)
text
- the text to be displayedalign
- LEFT, CENTER, or RIGHTpublic DTextArea(java.lang.String text, int align, int scrollbarVisibility)
text
- the text to be displayedalign
- LEFT, CENTER, or RIGHTscrollbarVisibility
- SCROLLBARS_NONE, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_VERTICAL_ONLY, or SCROLLBARS_BOTHMethod Detail |
public java.lang.String getText()
getText
in class DTextComponent
setText(java.lang.String)
public void setText(java.lang.String text)
setText
in class DTextComponent
getText()
public int getSelectionStart()
getSelectionStart
in class DTextComponent
public java.awt.Point getSelectionStartPoint()
protected java.awt.Point getPoint(int offset)
public void setSelectionStart(int selectionStart)
setSelectionStart
in class DTextComponent
selectionStart
- the start position of the textpublic int getSelectionEnd()
getSelectionEnd
in class DTextComponent
public java.awt.Point getSelectionEndPoint()
public void setSelectionEnd(int selectionEnd)
setSelectionEnd
in class DTextComponent
selectionEnd
- the start position of the textpublic void select(int selectionStart, int selectionEnd)
select
in class DTextComponent
selectionStart
- the start position of the textselectionEnd
- the end position of the textpublic void select(java.awt.Point selectionStart, java.awt.Point selectionEnd)
selectionStart
- the start coordinatesselectionEnd
- the end coordinatespublic void selectAll()
selectAll
in class DTextComponent
public int getCaretPosition()
getCaretPosition
in class DTextComponent
dog.gui.DTextComponent
public java.awt.Point getCaretPositionPoint()
public void moveLeft(boolean selected)
moveLeft
in class DTextComponent
public void moveRight(boolean selected)
moveRight
in class DTextComponent
public void moveWordLeft(boolean selected)
moveWordLeft
in class DTextComponent
public void moveWordRight(boolean selected)
moveWordRight
in class DTextComponent
public void moveLineStart(boolean selected)
moveLineStart
in class DTextComponent
public void moveLineEnd(boolean selected)
moveLineEnd
in class DTextComponent
public void moveUp(boolean selected)
public void moveDown(boolean selected)
public void deleteSelection()
deleteSelection
in class DTextComponent
public void deleteRight()
deleteRight
in class DTextComponent
public void deleteLeft()
deleteLeft
in class DTextComponent
public void insert(char ch, boolean selected)
insert
in class DTextComponent
public void insert(java.lang.String text, boolean selected)
insert
in class DTextComponent
public void append(java.lang.String text)
public int getAlign()
setAlign(int)
public void setAlign(int align)
align
- LEFT, CENTER, or RIGHTjava.lang.IllegalArgumentException
- if the alignment is not one of the above.getAlign()
public boolean isFilled()
public void setFilled(boolean filled)
public int getScrollbarVisibility()
setScrollbarVisibility(int)
public void setScrollbarVisibility(int scrollbarVisibility)
scrollbarVisibility
- SCROLLBARS_NONE, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_VERTICAL_ONLY, or SCROLLBARS_BOTHjava.lang.IllegalArgumentException
- if the policy is not one of the above.getScrollbarVisibility()
public int getRows()
setRows(int)
,
getColumns()
public void setRows(int rows)
rows
- the number of rows.java.lang.IllegalArgumentException
- if the value supplied for rows
is less than zero.getRows()
,
setColumns(int)
public int getColumns()
setColumns(int)
,
getRows()
public void setColumns(int columns)
columns
- the number of columns.java.lang.IllegalArgumentException
- if the value supplied for columns
is less than zero.getColumns()
,
setRows(int)
public void readFrom(java.io.Reader reader) throws java.io.IOException
reader
- the reader to read from.writeTo(java.io.Writer)
public void writeTo(java.io.Writer writer) throws java.io.IOException
writer
- the writer to write to.readFrom(java.io.Reader)
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class java.awt.Container
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Container
public void doLayout()
doLayout
in class java.awt.Container
public void paint(java.awt.Graphics g)
paint
in class java.awt.Container
public boolean isFocusTraversable()
isFocusTraversable
in class java.awt.Component
public void addActionListener(java.awt.event.ActionListener listener)
listener
- the action listenerpublic void removeActionListener(java.awt.event.ActionListener listener)
listener
- the action listenerprotected void processEvent(java.awt.AWTEvent event)
processEvent
in class DTextComponent
event
- the eventprotected void processActionEvent(java.awt.event.ActionEvent event)
event
- the action eventprotected void processFocusEvent(java.awt.event.FocusEvent event)
processFocusEvent
in class java.awt.Component
protected void processKeyEvent(java.awt.event.KeyEvent event)
processKeyEvent
in class java.awt.Component
protected void processMouseEvent(java.awt.event.MouseEvent event)
processMouseEvent
in class DContainer
protected void processMouseMotionEvent(java.awt.event.MouseEvent event)
processMouseMotionEvent
in class DContainer
public void timerFired(TimerEvent event)
timerFired
in interface TimerListener
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
adjustmentValueChanged
in interface java.awt.event.AdjustmentListener
protected java.lang.String paramString()
paramString
in class DTextComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |