E - component typeU - component UI typepublic interface Painter<E extends javax.swing.JComponent,U extends javax.swing.plaf.ComponentUI>
Whether or not single painter can be used for multiply components exclusively depends on its implementation. In most cases painters which does some animation won't work well with multiply components unless stated otherwise in JavaDoc.
AbstractPainter,
SpecificPainter,
SectionPainter| Modifier and Type | Method and Description |
|---|---|
void |
addPainterListener(PainterListener listener)
Adds new painter listener.
|
java.awt.Insets |
getBorders()
Returns borders required for visual data provided by this painter.
|
java.awt.Dimension |
getPreferredSize()
Returns preferred size required for proper painting of visual data provided by this painter.
|
void |
install(E c,
U ui)
Called when painter is installed onto some component.
|
java.lang.Boolean |
isOpaque()
Returns whether visual data provided by this painter is opaque or not.
|
void |
paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
Paints visual data using component graphics context.
|
void |
removePainterListener(PainterListener listener)
Removes painter listener.
|
void |
uninstall(E c,
U ui)
Called when painter is installed into some component.
|
void install(E c, U ui)
c - component this painter is being installed ontoui - component UIvoid uninstall(E c, U ui)
c - component this painter is being uninstalled fromui - component UIjava.lang.Boolean isOpaque()
java.awt.Insets getBorders()
You may pass null in case additional borders aren't needed for this painter.
null in case those aren't neededvoid paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
It is highly recommended to honor provided painting bounds to avoid painting issues. These bounds might be representing full component size or contain just a small portion of the component.
g2d - graphics contextbounds - painting boundsc - painted componentui - painted component UIjava.awt.Dimension getPreferredSize()
void addPainterListener(PainterListener listener)
listener - painter listener to addPainterListenervoid removePainterListener(PainterListener listener)
listener - painter listener to removePainterListener