public class QuadShpIcon extends Object implements Icon, Serializable, Paintable
Icon
it may be used as a JButton
's face.Modifier and Type | Field and Description |
---|---|
int |
anzPoints
Number of polygon points.
|
static int |
DOWN
Icon-Typ.
|
boolean |
filled
Filled or just lines.
|
protected boolean |
getFgColFromComp
Flag: as colour to paint with use embedding component's foreground colour.
|
protected static QuadShpIcon[] |
icons |
static int |
LEFT
Icon-Typ.
|
static int |
RIGHT
Icon-Typ.
|
int |
size
Surrounding square's size.
|
protected static int[] |
sizes |
static int |
SQUARE
Icon-Typ.
|
protected static int[] |
typs |
static int |
UP
Icon-Typ.
|
protected static int |
UPDNCSZ |
protected int[] |
xPs |
protected int[] |
yPs |
Modifier | Constructor and Description |
---|---|
protected |
QuadShpIcon(int size,
int[] xPs,
int[] yPs,
boolean filled)
Constructor without any checks.
|
|
QuadShpIcon(QuadShpIcon must,
boolean filled)
Construction another quadratic shaped icon according a template one.
|
Modifier and Type | Method and Description |
---|---|
int |
getIconHeight() |
int |
getIconWidth() |
static QuadShpIcon |
makeShapeIcon(Icon must,
boolean filled)
Make another quadratic shaped icon according a template one.
|
static QuadShpIcon |
makeShapeIcon(int size,
int[] xPs,
int[] yPs,
boolean filled)
Make a quadratic shaped icon.
|
static QuadShpIcon |
makeUpDownIcon(int size,
int typ,
boolean filled)
Make a quadratic shaped icon of standard type.
|
void |
paint(Graphics g,
int x,
int y,
int w,
int h)
Implementing Paintable.
|
void |
paintIcon(Component c,
Graphics g,
int x,
int y)
Malen als Icon.
|
void |
paintIt(Graphics g,
Color c)
Re-paint at origin (0, 0).
|
void |
setFgColor(Color fg,
boolean filled)
Set the colour to paint with.
|
public final int size
getIconHeight()
and getIconWidth()
both will return this
value.protected boolean getFgColFromComp
paintIcon(Component, Graphics, int, int)
.public final int anzPoints
protected final int[] xPs
protected final int[] yPs
public boolean filled
public static final int LEFT
public static final int RIGHT
public static final int UP
public static final int DOWN
public static final int SQUARE
protected static transient int[] sizes
protected static transient int[] typs
protected static transient QuadShpIcon[] icons
protected static final int UPDNCSZ
protected QuadShpIcon(int size, int[] xPs, int[] yPs, boolean filled)
public QuadShpIcon(QuadShpIcon must, boolean filled) throws NullPointerException
NullPointerException
public int getIconHeight()
getIconHeight
in interface Icon
public int getIconWidth()
getIconWidth
in interface Icon
public final void setFgColor(Color fg, boolean filled)
paintIcon(c, g, x, y)
with non null Component c
taking c's foreground colour
for painting.fg
- New foreground colour for painting; null use actual value or
set color by Compont provided to paint method(s)filled
- true: fill the polygon; false: just the lines (1px)public final void paintIcon(Component c, Graphics g, int x, int y)
paintIcon
in interface Icon
c
- Von dieser Komponente wird ggf. die Vordergrundfarbe übernommen;
darf null sein.Icon.paintIcon(java.awt.Component, java.awt.Graphics, int, int)
public final void paint(Graphics g, int x, int y, int w, int h)
paint
in interface Paintable
w
- h will be ignoret; a QuadShpIcon
has fixed quadratic sizeg
- 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!]Paintable
public static QuadShpIcon makeShapeIcon(int size, int[] xPs, int[] yPs, boolean filled) throws IllegalArgumentException
QuadShpIcon
object with given size
and polygon coordinates xPs and yPs.QuadShpIcon
object's
display figure.size
- The surrounding square's size (Pixel 5..255)xPs
- the figure's X-co-ordinates; number 3..12yPs
- the figure's Y-co-ordinates; same number / array size as xPs
filled
- start value for filled vs. just linesIllegalArgumentException
- if above conditions are violatedpublic static QuadShpIcon makeUpDownIcon(int size, int typ, boolean filled) throws IllegalArgumentException
makeShapeIcon(int, int[], int[], boolean)
except for choosing
an isosceles triangle pointing UP
, RIGHT
,
DOWN
or LEFT
or just a SQUARE
of icon
size.IllegalArgumentException
public static QuadShpIcon makeShapeIcon(Icon must, boolean filled) throws IllegalArgumentException
makeShapeIcon(int, int[], int[], boolean)
or
makeUpDownIcon(int, int, boolean)
with same parameter values
(no regarding filled which sets the start value of mutable state).must
- a QuadShpIcon
(!) to share size and figure
information withfilled
- start value for filled vs. just linesIllegalArgumentException
- if must is no QuadShpIcon