Swing Painting Guidelines
- For Swing components,
paint()
is always invoked as a result of both system-triggered and app-triggered paint requests;update()
is never invoked on Swing components. - Programs may trigger a future call to
paint()
by invokingrepaint()
, but shouldn't callpaint()
directly. - On components with complex output,
repaint()
should be invoked with arguments which define only the rectangle that needs updating, rather than the no-arg version, which causes the entire component to be repainted. - Swing's implementation of
paint()
factors the call into 3 separate callbacks:paintComponent()
paintBorder()
paintChildren()
paintComponent()
method (not withinpaint()
).
Reference:
No comments :
Post a Comment