Interface Painter
- All Known Implementing Classes:
BackgroundPainter, GlassTutorial, PainterChain, Timeline
public interface Painter
Painter can be used to draw on components backgrounds.
The use of this interface allows reuse of a background Painter for various
components.
A simple example of a background painter is shown here to draw a circle background:
Painter p = new Painter(cmp) {
public void paint(Graphics g, Rectangle rect) {
boolean antiAliased = g.isAntiAliased();
g.setAntiAliased(true);
int r = Math.min(rect.getWidth(), rect.getHeight())/2;
int x = rect.getX() + rect.getWidth()/2 - r;
int y = rect.getY() + rect.getHeight()/2 - r;
switch (style) {
case CircleButtonStrokedDark:
case CircleButtonStrokedLight: {
if (cmp.getStyle().getBgTransparency() != 0) {
int alpha = cmp.getStyle().getBgTransparency();
if (alpha {
int x = tf1.getAbsoluteX() + tf1.getWidth();
int y = tf1.getAbsoluteY();
x -= warningImage.getWidth() / 2;
y += (tf1.getHeight() / 2 - warningImage.getHeight() / 2);
g.drawImage(warningImage, x, y);
});
hi.show();
-
Method Summary
-
Method Details
-
paint
-