|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object abbot.editor.widgets.AbstractComponentDecorator
public abstract class AbstractComponentDecorator
Provide a method for consistently augmenting the appearance of a given
component by painting something on it after the component itself
gets painted. If not explicitly removed via dispose()
, an instance
of this object will live as long as its target component.
By default, the decorator matches the location and size of the decorated
component, but the bounds can be adjusted by overriding
getDecorationBounds()
. The synch()
method should be called
whenever the bounds returned by getDecorationBounds()
would change.
The decoration is clipped to the bounds set on the decoration, which does not necessarily need to be the same as the decorated component's bounds. The decoration may extend beyond the decorated component bounds, or it may be reduced to a smaller region.
Nested Class Summary | |
---|---|
protected class |
AbstractComponentDecorator.Painter
Used to hook into the Swing painting and event architecture. |
Field Summary | |
---|---|
static Rectangle |
DEFAULT_BOUNDS
|
static int |
TOP
|
Constructor Summary | |
---|---|
AbstractComponentDecorator(JComponent c)
Create a decorator for the given component. |
|
AbstractComponentDecorator(JComponent c,
int layerOffset)
Create a decorator for the given component, indicating the layer offset from the target component. |
|
AbstractComponentDecorator(JComponent c,
int layerOffset,
int position)
Create a decorator with the given position within its layer. |
Method Summary | |
---|---|
protected void |
attach()
|
protected Rectangle |
clipDecorationBounds(Rectangle decorated)
Adjust the painting offsets and size of the decoration to account for ancestor clipping. |
void |
dispose()
Stop decorating. |
protected JComponent |
getComponent()
Returns the decorated component. |
protected Rectangle |
getDecorationBounds()
Return the bounds, relative to the decorated component, of the decoration. |
protected JComponent |
getPainter()
Returns the component used to paint the decoration and optionally track events. |
String |
getToolTipText()
Return the currently set default tooltip text. |
String |
getToolTipText(MouseEvent e)
Provide for different tool tips depending on the actual location over the decoration. |
boolean |
isShowing()
Indicate whether the decoration is showing. |
boolean |
isVisible()
Indicate whether any of the decoration is visible. |
abstract void |
paint(Graphics g)
Define the decoration's appearance. |
void |
repaint()
Force a refresh of the underlying component and its decoration. |
void |
setCursor(Cursor cursor)
Set the cursor to appear anywhere over the decoration bounds. |
void |
setDecorationBounds(int x,
int y,
int w,
int h)
Change the bounds of the decoration, relative to the decorated component. |
void |
setDecorationBounds(Rectangle bounds)
Change the bounds of the decoration, relative to the decorated component. |
protected void |
setPainterBounds(int x,
int y,
int w,
int h)
|
void |
setToolTipText(String text)
Set the text to be displayed when the mouse is over the decoration. |
void |
setVisible(boolean visible)
Use this to change the visibility of the decoration. |
protected void |
synch()
Ensure the size of the decorator matches the current decoration bounds with appropriate clipping to viewports. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Rectangle DEFAULT_BOUNDS
public static final int TOP
Constructor Detail |
---|
public AbstractComponentDecorator(JComponent c)
public AbstractComponentDecorator(JComponent c, int layerOffset)
public AbstractComponentDecorator(JComponent c, int layerOffset, int position)
TOP
to cover other decorations, or BOTTOM
to be covered by other decorations.WARNING: BOTTOM doesn't currently work, probably a JLayeredPane bug in either the code or documentation.
JLayeredPane
Method Detail |
---|
public void setToolTipText(String text)
JComponent.setToolTipText(String)
public String getToolTipText()
JComponent.setToolTipText(java.lang.String)
public String getToolTipText(MouseEvent e)
setToolTipText(String)
with
a non-null argument.
JComponent.getToolTipText(MouseEvent)
public boolean isShowing()
public boolean isVisible()
public void setVisible(boolean visible)
protected void attach()
protected void synch()
protected Rectangle clipDecorationBounds(Rectangle decorated)
protected Rectangle getDecorationBounds()
public void setDecorationBounds(Rectangle bounds)
DEFAULT_BOUNDS
means the bounds
will track the component bounds.
public void setDecorationBounds(int x, int y, int w, int h)
protected void setPainterBounds(int x, int y, int w, int h)
protected JComponent getComponent()
protected JComponent getPainter()
public void setCursor(Cursor cursor)
public void repaint()
public void dispose()
public abstract void paint(Graphics g)
getDecorationBounds()
, which defaults to the
decorated component bounds.
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |