public class SwingWrapper extends AbstractFigure
Constructor and Description |
---|
SwingWrapper(javax.swing.JComponent c)
Construct a new swing wrapper instance
to wrap the given component.
|
Modifier and Type | Method and Description |
---|---|
java.awt.geom.Rectangle2D |
getBounds()
Get the bounding box of this figure.
|
javax.swing.JComponent |
getComponent()
Return the component that this is
wrapping.
|
java.awt.Shape |
getShape()
Get the shape of this figure.
|
void |
paint(java.awt.Graphics2D g)
Ask the wrapped component to paint itself.
|
void |
setComponent(javax.swing.JComponent c)
Replace the currently wrapped component
with the given component and reshape/repaint
the figure.
|
void |
setParent(CanvasComponent fc)
Set the parent of this figure.
|
void |
transform(java.awt.geom.AffineTransform at)
Transform the figure with the supplied transform.
|
void |
translate(double x,
double y)
Translate the figure by the given distance.
|
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setToolTipText, setUserObject, setVisible
public SwingWrapper(javax.swing.JComponent c)
public java.awt.geom.Rectangle2D getBounds()
getBounds
in interface Figure
getBounds
in class AbstractFigure
public javax.swing.JComponent getComponent()
public java.awt.Shape getShape()
getShape
in interface Figure
getShape
in class AbstractFigure
public void paint(java.awt.Graphics2D g)
paint
in interface VisibleComponent
paint
in class AbstractFigure
g
- The 2D graphics object that this object
it to be painted upon.public void setComponent(javax.swing.JComponent c)
public void setParent(CanvasComponent fc)
setParent
in interface Figure
setParent
in class AbstractFigure
fc
- The parent of the figure.Figure.getParent()
public void transform(java.awt.geom.AffineTransform at)
transform
in interface Figure
transform
in class AbstractFigure
at
- The transform to be used.public void translate(double x, double y)
translate
in interface Figure
translate
in class AbstractFigure
x
- The x value to be moved.y
- The y value to be moved.