| Constructor and Description |
|---|
TooltipPainter()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
paint(java.awt.Graphics2D g,
java.awt.geom.AffineTransform worldToScreen,
double w,
double h)
Perform the painting operations on the given Graphics.
|
void |
set(double worldX,
double worldY,
java.lang.String text)
Set the tooltip that should be painted.
|
void |
setAnchor(double x,
double y)
Set the anchor point for the tooltip.
|
public void setAnchor(double x,
double y)
x - The x-coordinate of the anchor pointy - The y-coordinate of the anchor pointpublic void set(double worldX,
double worldY,
java.lang.String text)
null, then nothing will be paintedworldX - The x-coordinate of the world positionworldY - The y-coordinate of the world positiontext - The textpublic void paint(java.awt.Graphics2D g,
java.awt.geom.AffineTransform worldToScreen,
double w,
double h)
PainterGraphics instance will be passed to
all painters. No painter should make any assumptions about the state of
the Graphics object. Changes in the given Graphics object will affect
painters that are called subsequently. This refers to configuration
settings, like the rendering hints, but also to the
transform of the Graphics.Viewer. If a painter modifies these settings, then it should
either restore the original settings afterwards, or create a local
copy of the Graphics object in order to avoid interferences with
other painters.
public void paint(
Graphics2D g, AffineTransform worldToScreen, double w, double h)
{
// Store the original transform
AffineTransform oldAT = g.getTransform();
// Perform custom transforms and painting
g.translate(100,100);
g.drawLine(10,20,30,40);
...
// Restore the original transform
g.setTransform(oldAT);
}
The AffineTransform that is passed to this method
may also be the same for multiple painters. Usually, the caller
should make sure that modifications of this transform do not
affect painters that are called subsequently, but in general,
it is not recommended to internally store or modify the given
affine transform object. paint in interface Painterg - The Graphics used for paintingworldToScreen - The world-to-screen transform. This transform
encapsulates the translation, rotation and scaling of the viewer
to which this painter belongs.w - The width of the area, in screen coordinates, in which
this painter operates. This is the screen size of the viewer to
which this painter belongs.h - The height of the area, in screen coordinates, in which
this painter operates. This is the screen size of the viewer to
which this painter belongs.Copyright © 2019. All Rights Reserved.