|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.wtk.skin.ComponentSkin
org.apache.pivot.wtk.skin.TextAreaSkin
public class TextAreaSkin
Text area skin.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TextAreaListener |
---|
TextAreaListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TextAreaContentListener |
---|
TextAreaContentListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener |
---|
ComponentListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener |
---|
ComponentStateListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener |
---|
ComponentMouseListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener |
---|
ComponentMouseButtonListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener |
---|
ComponentKeyListener.Adapter |
Constructor Summary | |
---|---|
TextAreaSkin()
|
Method Summary | |
---|---|
void |
editableChanged(TextArea textArea)
Called when a text area's editable state has changed. |
void |
enabledChanged(Component component)
Called when a component's enabled state has changed. |
void |
focusedChanged(Component component,
Component obverseComponent)
Called when a component's focused state has changed. |
boolean |
getAcceptsEnter()
|
boolean |
getAcceptsTab()
Gets current value of style that determines the behavior of TAB and Ctrl-TAB characters. |
Color |
getBackgroundColor()
|
int |
getBaseline(int width,
int height)
Returns the baseline for a given width and height. |
Bounds |
getCharacterBounds(int index)
Returns the bounds of the character at a given index. |
Color |
getColor()
Returns the foreground color of the text |
Font |
getFont()
Returns the font of the text |
Color |
getInactiveColor()
|
Color |
getInactiveSelectionBackgroundColor()
|
Color |
getInactiveSelectionColor()
|
int |
getInsertionPoint(int x,
int y)
Returns the insertion point for a given location. |
int |
getLineWidth()
|
Insets |
getMargin()
Returns the amount of space between the edge of the TextArea and its text |
int |
getNextInsertionPoint(int x,
int from,
TextArea.ScrollDirection direction)
Returns the next insertion point given an x coordinate and a character index. |
int |
getPreferredHeight(int width)
Returns the visual's preferred height given the provided width constraint. |
Dimensions |
getPreferredSize()
Returns the visual's unconstrained preferred size. |
int |
getPreferredWidth(int height)
Returns the visual's preferred width given the provided height constraint. |
int |
getRowAt(int index)
Returns the row index of the character at a given index. |
int |
getRowCount()
Returns the total number of rows in the text area. |
int |
getRowLength(int index)
Returns the number of characters in the row containing a given character index. |
int |
getRowOffset(int index)
Returns the index of the first character in the row containing a given character index. |
Area |
getSelection()
|
Color |
getSelectionBackgroundColor()
|
Color |
getSelectionColor()
|
int |
getTabWidth()
Returns the current setting of the "tabWidth" style (so "setText" uses the same value as Ctrl-Tab from user). |
boolean |
getWrapText()
|
void |
install(Component component)
Associates a skin with a component. |
boolean |
isOpaque()
By default, skins are assumed to be opaque. |
boolean |
keyPressed(Component component,
int keyCode,
Keyboard.KeyLocation keyLocation)
TAB Transfers focus forwardsTAB + SHIFT Transfers focus
backwards |
boolean |
keyTyped(Component component,
char character)
Called when a key has been typed. |
void |
layout()
If the component on which the skin is installed is a container, lays out the container's children. |
void |
maximumLengthChanged(TextArea textArea,
int previousMaximumLength)
Called when a text area's maximum length has changed. |
boolean |
mouseClick(Component component,
Mouse.Button button,
int x,
int y,
int count)
Called when a mouse button is clicked over a component. |
boolean |
mouseDown(Component component,
Mouse.Button button,
int x,
int y)
Called when a mouse button is pressed over a component. |
boolean |
mouseMove(Component component,
int x,
int y)
Called when the mouse is moved over a component. |
boolean |
mouseUp(Component component,
Mouse.Button button,
int x,
int y)
Called when a mouse button is released over a component. |
void |
paint(Graphics2D graphics)
Paints the visual. |
void |
paragraphInserted(TextArea textArea,
int index)
Called when a paragraph has been inserted into a text area's paragraph sequence. |
void |
paragraphsRemoved(TextArea textArea,
int index,
Sequence<TextArea.Paragraph> removed)
Called when paragraphs have been removed from a text area's paragraph sequence. |
void |
selectionChanged(TextArea textArea,
int previousSelectionStart,
int previousSelectionLength)
Called when a text area's selection state has changed. |
void |
setAcceptsEnter(boolean acceptsEnter)
|
void |
setAcceptsTab(boolean acceptsTab)
Sets current value of style that determines the behavior of TAB and Ctrl-TAB characters. |
void |
setBackgroundColor(Color backgroundColor)
|
void |
setBackgroundColor(String backgroundColor)
|
void |
setColor(Color color)
Sets the foreground color of the text |
void |
setColor(String color)
Sets the foreground color of the text |
void |
setFont(Dictionary<String,?> font)
Sets the font of the text |
void |
setFont(Font font)
Sets the font of the text |
void |
setFont(String font)
Sets the font of the text |
void |
setInactiveColor(Color inactiveColor)
|
void |
setInactiveColor(String inactiveColor)
|
void |
setInactiveSelectionBackgroundColor(Color inactiveSelectionBackgroundColor)
|
void |
setInactiveSelectionBackgroundColor(String inactiveSelectionBackgroundColor)
|
void |
setInactiveSelectionColor(Color inactiveSelectionColor)
|
void |
setInactiveSelectionColor(String inactiveSelectionColor)
|
void |
setLineWidth(int lineWidth)
|
void |
setMargin(Dictionary<String,?> margin)
Sets the amount of space between the edge of the TextArea and its text |
void |
setMargin(Insets margin)
Sets the amount of space between the edge of the TextArea and its text |
void |
setMargin(int margin)
Sets the amount of space between the edge of the TextArea and its text |
void |
setMargin(Number margin)
Sets the amount of space between the edge of the TextArea and its text |
void |
setMargin(String margin)
Sets the amount of space between the edge of the TextArea and its text |
void |
setSelectionBackgroundColor(Color selectionBackgroundColor)
|
void |
setSelectionBackgroundColor(String selectionBackgroundColor)
|
void |
setSelectionColor(Color selectionColor)
|
void |
setSelectionColor(String selectionColor)
|
void |
setTabWidth(int tabWidth)
|
void |
setWrapText(boolean wrapText)
|
void |
textChanged(TextArea textArea)
Called when a text area's text has changed. |
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin |
---|
cursorChanged, decodeFont, dragSourceChanged, dropTargetChanged, getBaseline, getComponent, getHeight, getWidth, heightLimitsChanged, invalidateComponent, isFocusable, keyReleased, locationChanged, menuHandlerChanged, mouseOut, mouseOver, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setSize, sizeChanged, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextAreaSkin()
Method Detail |
---|
public void install(Component component)
Skin
install
in interface Skin
install
in class ComponentSkin
component
- The component to which the skin is being attached.public int getPreferredWidth(int height)
ConstrainedVisual
getPreferredWidth
in interface ConstrainedVisual
height
- The height by which to constrain the preferred width, or -1
for no constraint.public int getPreferredHeight(int width)
ConstrainedVisual
getPreferredHeight
in interface ConstrainedVisual
width
- The width by which to constrain the preferred height, or -1
for no constraint.public Dimensions getPreferredSize()
ConstrainedVisual
getPreferredSize
in interface ConstrainedVisual
getPreferredSize
in class ComponentSkin
public void layout()
Skin
layout
in interface Skin
public int getBaseline(int width, int height)
ConstrainedVisual
getBaseline
in interface ConstrainedVisual
getBaseline
in class ComponentSkin
public void paint(Graphics2D graphics)
Visual
paint
in interface Visual
graphics
- The graphics context in which to paint the visual.public boolean isOpaque()
ComponentSkin
isOpaque
in interface Skin
isOpaque
in class ComponentSkin
public int getInsertionPoint(int x, int y)
TextArea.Skin
getInsertionPoint
in interface TextArea.Skin
public int getNextInsertionPoint(int x, int from, TextArea.ScrollDirection direction)
TextArea.Skin
getNextInsertionPoint
in interface TextArea.Skin
public int getRowAt(int index)
TextArea.Skin
getRowAt
in interface TextArea.Skin
public int getRowOffset(int index)
TextArea.Skin
getRowOffset
in interface TextArea.Skin
public int getRowLength(int index)
TextArea.Skin
getRowLength
in interface TextArea.Skin
public int getRowCount()
TextArea.Skin
getRowCount
in interface TextArea.Skin
public Bounds getCharacterBounds(int index)
TextArea.Skin
getCharacterBounds
in interface TextArea.Skin
public Area getSelection()
public Font getFont()
public void setFont(Font font)
public final void setFont(String font)
font
- A font specification
public final void setFont(Dictionary<String,?> font)
font
- A dictionary describing a font
public Color getColor()
public void setColor(Color color)
public final void setColor(String color)
color
- Any of the color values recognized by Pivot.public Color getBackgroundColor()
public void setBackgroundColor(Color backgroundColor)
public final void setBackgroundColor(String backgroundColor)
public Color getInactiveColor()
public void setInactiveColor(Color inactiveColor)
public final void setInactiveColor(String inactiveColor)
public Color getSelectionColor()
public void setSelectionColor(Color selectionColor)
public final void setSelectionColor(String selectionColor)
public Color getSelectionBackgroundColor()
public void setSelectionBackgroundColor(Color selectionBackgroundColor)
public final void setSelectionBackgroundColor(String selectionBackgroundColor)
public Color getInactiveSelectionColor()
public void setInactiveSelectionColor(Color inactiveSelectionColor)
public final void setInactiveSelectionColor(String inactiveSelectionColor)
public Color getInactiveSelectionBackgroundColor()
public void setInactiveSelectionBackgroundColor(Color inactiveSelectionBackgroundColor)
public final void setInactiveSelectionBackgroundColor(String inactiveSelectionBackgroundColor)
public Insets getMargin()
public void setMargin(Insets margin)
public final void setMargin(Dictionary<String,?> margin)
margin
- A dictionary with keys in the set {left, top, bottom, right}.public final void setMargin(int margin)
public final void setMargin(Number margin)
public final void setMargin(String margin)
margin
- A string containing an integer or a JSON dictionary with keys
left, top, bottom, and/or right.public boolean getWrapText()
public void setWrapText(boolean wrapText)
public boolean getAcceptsEnter()
public void setAcceptsEnter(boolean acceptsEnter)
public boolean getAcceptsTab()
public void setAcceptsTab(boolean acceptsTab)
acceptsTab
- true if TAB inserts an
appropriate number of spaces, while Ctrl-TAB
shifts focus to next component. false (default)
means TAB shifts focus and Ctrl-TAB
inserts spaces.public int getTabWidth()
TextArea.Skin
getTabWidth
in interface TextArea.Skin
public void setTabWidth(int tabWidth)
public int getLineWidth()
public void setLineWidth(int lineWidth)
public boolean mouseMove(Component component, int x, int y)
ComponentMouseListener
mouseMove
in interface ComponentMouseListener
mouseMove
in class ComponentSkin
public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
ComponentMouseButtonListener
mouseDown
in interface ComponentMouseButtonListener
mouseDown
in class ComponentSkin
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
ComponentMouseButtonListener
mouseUp
in interface ComponentMouseButtonListener
mouseUp
in class ComponentSkin
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
ComponentMouseButtonListener
mouseClick
in interface ComponentMouseButtonListener
mouseClick
in class ComponentSkin
public boolean keyTyped(Component component, char character)
ComponentKeyListener
keyTyped
in interface ComponentKeyListener
keyTyped
in class ComponentSkin
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
ComponentSkin
TAB
Transfers focus forwardsTAB
+ SHIFT
Transfers focus
backwards
keyPressed
in interface ComponentKeyListener
keyPressed
in class ComponentSkin
public void enabledChanged(Component component)
ComponentStateListener
Called both when the component is enabled and when it is disabled.
The component's enabled
flag has already been set when this
method is called so the new state can be determined by calling the
Component.isEnabled()
method.
enabledChanged
in interface ComponentStateListener
enabledChanged
in class ComponentSkin
component
- The component whose enabled state is changing.public void focusedChanged(Component component, Component obverseComponent)
ComponentStateListener
This will be called both when a component gains focus and when it loses
focus. The currently focused component has already been set when this method
is called, so that the new state of the component can be determined by calling
the Component.isFocused()
method.
focusedChanged
in interface ComponentStateListener
focusedChanged
in class ComponentSkin
component
- The component that is either gaining focus or the one that
previously had focus and is now losing it.obverseComponent
- If the component is gaining focus, this is the component
that is losing focus. If the component is losing focus
this is the component that is gaining the focus instead.public void maximumLengthChanged(TextArea textArea, int previousMaximumLength)
TextAreaListener
maximumLengthChanged
in interface TextAreaListener
public void editableChanged(TextArea textArea)
TextAreaListener
editableChanged
in interface TextAreaListener
public void paragraphInserted(TextArea textArea, int index)
TextAreaContentListener
paragraphInserted
in interface TextAreaContentListener
textArea
- The source of the event.index
- The index at which the paragraph was inserted.public void paragraphsRemoved(TextArea textArea, int index, Sequence<TextArea.Paragraph> removed)
TextAreaContentListener
paragraphsRemoved
in interface TextAreaContentListener
textArea
- The source of the event.index
- The starting index from which the paragraphs were removed.removed
- The paragraphs that were removed.public void textChanged(TextArea textArea)
TextAreaContentListener
textChanged
in interface TextAreaContentListener
textArea
- The source of the event.public void selectionChanged(TextArea textArea, int previousSelectionStart, int previousSelectionLength)
TextAreaSelectionListener
selectionChanged
in interface TextAreaSelectionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |