Package games.stendhal.client.gui
Class ComponentPaintCache
java.lang.Object
games.stendhal.client.gui.ComponentPaintCache
Cached painting for components that need it. Components using this need
to implement the
Cacheable
interface, and override the paint
method to something like:
public void paint(Graphics g) { cache.paintComponent(g); paintChildren(g); }Also, the components need to call
cache.invalidate()
should
the component need a proper redraw. Size changes are automatically handled.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface for components that useComponentPaintCache
. -
Constructor Summary
ConstructorDescriptionComponentPaintCache(ComponentPaintCache.Cacheable component)
Create a new paint cache. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Paint the cached component.void
setPaintChildren(boolean paint)
Set if the child components should be cached as images as well.
-
Constructor Details
-
ComponentPaintCache
Create a new paint cache.- Parameters:
component
- the cached component
-
-
Method Details
-
paintComponent
Paint the cached component.- Parameters:
g
- graphics
-
setPaintChildren
public void setPaintChildren(boolean paint)Set if the child components should be cached as images as well. The default is not caching. Do change it to true unless the children are static images or you take care of calling invalidate() when they change.- Parameters:
paint
-true
if the child components should be included in the cached image,false
otherwise
-