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:
Painters can also be used to draw the glasspane which is layered on top of the form.
The example shows a glasspane running on top of a field to show a validation hint,
notice that for real world usage you should probably look into Validator
.
Also notice that this example uses the shorter Java 8 lambda syntax to represent the glasspane.
Modifier and Type | Method and Description |
---|---|
void |
paint(Graphics g,
Rectangle rect)
Draws inside the given rectangle clipping area.
|
Copyright © 2023. All rights reserved.