@MinDoc(copyright="Copyright 1998 - 2004, 2009, 2016 A. Weinert", author="Albrecht Weinert", version="V.33", lastModified="27.03.2021", usage="just paint it", purpose="type for all elements, paintable anywhere within a given rectangle") public interface Paintable
paint(Graphics, int, int, int, int)
. This method must
be overridden in implementing classes needing this feature (and not being
content with this default implementation (just drawing a filled
rectangle).paint(Graphics, Point, Dimension)
(legacy) and
paint(Graphics, ConstIntPair, ConstIntPair)
. They can be used
wherever their signature is more fitting or better readable. Both shall
be left unchanged, as they delegate to
paint(Graphics, int, int, int, int)
.
Icon
. The differences are:Icon
object defines a fixed size. The
Paintable
gets the (maximum) size with the paint call.Paintable
object defines all else properties of it's
appearance. A swing.Icon
on the other hand
may copy them from another Component
.WeAutLogo
Modifier and Type | Method and Description |
---|---|
default void |
paint(Graphics g,
ConstIntPair p,
ConstIntPair d)
The (enhanced) paint method.
|
void |
paint(Graphics g,
int x,
int y,
int width,
int height)
The (one) paint method.
|
default void |
paint(Graphics g,
Point p,
Dimension d)
The (legacy) paint method.
|
void paint(Graphics g, int x, int y, int width, int height)
Paintable
object to paint itself to a
given location and a given size.paint(...)
should give a
(simple) graphical representation of this object as does
Object.toString()
in text form.g
- The notorious Graphics
object (that can
nowadays be expected to be a Graphics2D
).x
- y are the left upper corner of where to paint;
y grows downwards [sic!]width
- height are the size of an surrounding rectangle
to paint within; if null (0, 0) either this object's
"natural" size (if there is such thing) shall be used
or nothing is to be donedefault void paint(Graphics g, Point p, Dimension d)
Paintable
object to paint itself to a
given location and a given size.paint(...)
should give a
(simple) graphical representation of this object as does
Object.toString()
in text form.g
- The notorious Graphics
object (that can
nowadays be expected to be a Graphics2D
).p
- The left upper corner of where to paint; if null (0,0)
shall be usedd
- The size of an surrounding rectangle to paint within; if null
the object "natural" size (if there is such thing)
shall be useddefault void paint(Graphics g, ConstIntPair p, ConstIntPair d)
Paintable
object to paint itself to a
given location and a given size.paint(Graphics, Point, Dimension)
.g
- The notorious Graphics
object (that can
nowadays be expected to be a Graphics2D
).p
- The left upper corner of where to paint; if null (0,0)
shall be usedd
- The size of an surrounding rectangle to paint within; if null or
IntPairFix.ZEROS
this object's "natural" size
(if there is such thing) shall be used