|
||||||||||
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.ContainerSkin
org.apache.pivot.wtk.skin.TextPaneSkin
public class TextPaneSkin
Text pane skin.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin |
---|
ContainerSkin.IndexFocusTraversalPolicy |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TextPaneListener |
---|
TextPaneListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListener |
---|
ContainerListener.Adapter |
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener |
---|
ContainerMouseListener.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 | |
---|---|
TextPaneSkin()
|
Method Summary | |
---|---|
(package private) TextPaneSkinNodeView |
createNodeView(Node node)
|
void |
documentChanged(TextPane textPane,
Document previousDocument)
Called when a text pane's document has changed. |
void |
editableChanged(TextPane textPane)
Called when a text pane'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. |
int |
getBaseline(int width,
int height)
Returns the baseline for a given width and height. |
Bounds |
getCharacterBounds(int offset)
Returns the bounds of the character at a given offset within the document. |
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. |
Insets |
getMargin()
Returns the amount of space between the edge of the TextPane and its Document |
int |
getNextInsertionPoint(int x,
int from,
TextPane.ScrollDirection direction)
Returns the next insertion point given an x coordinate and a character offset. |
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 offset)
Returns the row index of the character at a given offset within the document. |
int |
getRowCount()
Returns the total number of rows in the document. |
(package private) Area |
getSelection()
|
Color |
getSelectionBackgroundColor()
|
Color |
getSelectionColor()
|
boolean |
getWrapText()
|
void |
install(Component component)
Associates a skin with a component. |
(package private) void |
invalidateNodeViewTree()
|
boolean |
isFocusable()
By default, skins are focusable. |
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. |
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 |
selectionChanged(TextPane textPane,
int previousSelectionStart,
int previousSelectionLength)
Called when a text pane's selection state has changed. |
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 |
setMargin(Dictionary<String,?> margin)
Sets the amount of space between the edge of the TextPane and its Document |
void |
setMargin(Insets margin)
Sets the amount of space between the edge of the TextPane and its Document |
void |
setMargin(int margin)
Sets the amount of space between the edge of the TextPane and its Document |
void |
setMargin(Number margin)
Sets the amount of space between the edge of the TextPane and its Document |
void |
setMargin(String margin)
Sets the amount of space between the edge of the TextPane and its Document |
void |
setSelectionBackgroundColor(Color selectionBackgroundColor)
|
void |
setSelectionBackgroundColor(String selectionBackgroundColor)
|
void |
setSelectionColor(Color selectionColor)
|
void |
setSelectionColor(String selectionColor)
|
void |
setWrapText(boolean wrapText)
|
Methods inherited from class org.apache.pivot.wtk.skin.ContainerSkin |
---|
componentInserted, componentMoved, componentsRemoved, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isOpaque, mouseDown, mouseMove, mouseUp, mouseWheel, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint |
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin |
---|
cursorChanged, decodeFont, dragSourceChanged, dropTargetChanged, getBaseline, getComponent, getHeight, getWidth, heightLimitsChanged, invalidateComponent, 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 TextPaneSkin()
Method Detail |
---|
public void install(Component component)
Skin
install
in interface Skin
install
in class ContainerSkin
component
- The component to which the skin is being attached.public boolean isFocusable()
ComponentSkin
isFocusable
in interface Skin
isFocusable
in class ContainerSkin
public int getPreferredWidth(int height)
ConstrainedVisual
getPreferredWidth
in interface ConstrainedVisual
getPreferredWidth
in class ContainerSkin
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
getPreferredHeight
in class ContainerSkin
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 int getBaseline(int width, int height)
ConstrainedVisual
getBaseline
in interface ConstrainedVisual
getBaseline
in class ComponentSkin
public void layout()
Skin
layout
in interface Skin
public void paint(Graphics2D graphics)
Visual
paint
in interface Visual
paint
in class ContainerSkin
graphics
- The graphics context in which to paint the visual.public int getInsertionPoint(int x, int y)
TextPane.Skin
getInsertionPoint
in interface TextPane.Skin
public int getNextInsertionPoint(int x, int from, TextPane.ScrollDirection direction)
TextPane.Skin
getNextInsertionPoint
in interface TextPane.Skin
public int getRowAt(int offset)
TextPane.Skin
getRowAt
in interface TextPane.Skin
public int getRowCount()
TextPane.Skin
getRowCount
in interface TextPane.Skin
public Bounds getCharacterBounds(int offset)
TextPane.Skin
getCharacterBounds
in interface TextPane.Skin
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 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 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 documentChanged(TextPane textPane, Document previousDocument)
TextPaneListener
documentChanged
in interface TextPaneListener
public void editableChanged(TextPane textPane)
TextPaneListener
editableChanged
in interface TextPaneListener
public void selectionChanged(TextPane textPane, int previousSelectionStart, int previousSelectionLength)
TextPaneSelectionListener
selectionChanged
in interface TextPaneSelectionListener
TextPaneSkinNodeView createNodeView(Node node)
Area getSelection()
void invalidateNodeViewTree()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |