I mean, only store it the *first* time you do the drawing. Something like this:
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.geom.Rectangle2D;
import...
Type: Posts; User: KevinWorkman
I mean, only store it the *first* time you do the drawing. Something like this:
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.geom.Rectangle2D;
import...
You're thinking too hard. When I said "cache", all I meant was "save the value to a variable".
Can't you just cache the values the first time you paint, and then not recalculate them after that?
This assumes that the font of the component, or the way it's being drawn, won't change.