|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.swing.LabelSausage
com.threerings.miso.client.SceneObjectTip
public class SceneObjectTip
A lightweight tooltip used by the MisoScenePanel. The tip
foreground and background are controlled by the following UIManager properties:
SceneObjectTip.background SceneObjectTip.foreground SceneObjectTip.font (falls back to Label.font)
| Nested Class Summary | |
|---|---|
protected static class |
SceneObjectTip.DefaultLayout
Our default tip layout algorithm which centers the tip in the bounds of the object in question. |
protected static class |
SceneObjectTip.LayoutReg
Used to store SceneObjectTip.TipLayout registrations. |
static interface |
SceneObjectTip.TipLayout
Used to position a scene tip in relation to the object with which it is associated. |
| Field Summary | |
|---|---|
protected static Color |
_background
Colors to use when rendering the tip. |
protected static Font |
_font
The font to use when rendering the tip. |
protected static Color |
_foreground
Colors to use when rendering the tip. |
protected static ComparableArrayList<SceneObjectTip.LayoutReg> |
_layouts
Contains a sorted list of layout registrations. |
protected static Composite |
ALPHA
The alpha we use for our base. |
Rectangle |
bounds
The bounding box of this tip, or null prior to layout(). |
protected static int |
EXTRA_PAD
The number of pixels to pad between the icon and text. |
protected static int |
ICON_PAD
The number of pixels to pad around the icon. |
| Fields inherited from class com.samskivert.swing.LabelSausage |
|---|
_dia, _icon, _label, _lxoff, _lyoff, _size, _xoff, _yoff |
| Constructor Summary | |
|---|---|
SceneObjectTip(String text,
Icon icon)
Construct a SceneObjectTip. |
|
| Method Summary | |
|---|---|
protected void |
drawBase(Graphics2D gfx,
int x,
int y)
|
Rectangle |
getBounds()
Returns the bounds of the indicator when drawn. |
boolean |
isLaidOut()
Returns whether the indicator has already been laid out (and thus doesn't need to be again) |
void |
layout(Graphics2D gfx,
SceneObject tipFor,
Rectangle boundary)
Called to initialize the tip so that it can be painted. |
void |
paint(Graphics2D gfx)
Paints the indicator in the scene. |
static void |
registerTipLayout(String prefix,
SceneObjectTip.TipLayout layout)
It may be desirable to layout object tips specially depending on what sort of actions they represent, so we allow different tip layout algorithms to be registered for particular object prefixes. |
void |
removed()
Called when the indicator is removed from the scene. |
String |
toString()
Generates a string representation of this instance. |
void |
update(Icon icon,
String tiptext)
Updates the Icon and text for the indicator. |
| Methods inherited from class com.samskivert.swing.LabelSausage |
|---|
drawBorder, drawExtras, drawIcon, drawLabel, layout, layout, paint |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public Rectangle bounds
protected static final Composite ALPHA
protected static Color _background
protected static Color _foreground
protected static Font _font
protected static ComparableArrayList<SceneObjectTip.LayoutReg> _layouts
protected static final int ICON_PAD
protected static final int EXTRA_PAD
| Constructor Detail |
|---|
public SceneObjectTip(String text,
Icon icon)
| Method Detail |
|---|
public boolean isLaidOut()
SceneObjectIndicator
isLaidOut in interface SceneObjectIndicator
public void layout(Graphics2D gfx,
SceneObject tipFor,
Rectangle boundary)
layout in interface SceneObjectIndicatortipFor - the scene object that we're a tip for.boundary - the boundary of all displayable space.public void paint(Graphics2D gfx)
SceneObjectIndicatorSceneObjectIndicator.layout(Graphics2D, SceneObject, Rectangle)
paint in interface SceneObjectIndicatorpublic Rectangle getBounds()
SceneObjectIndicator
getBounds in interface SceneObjectIndicatorpublic void removed()
SceneObjectIndicator
removed in interface SceneObjectIndicator
public void update(Icon icon,
String tiptext)
SceneObjectIndicator
update in interface SceneObjectIndicatorpublic String toString()
toString in class Object
public static void registerTipLayout(String prefix,
SceneObjectTip.TipLayout layout)
protected void drawBase(Graphics2D gfx,
int x,
int y)
drawBase in class LabelSausage
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||