Hello,
Im doing lots of drawing in my java app. I respond
to mouse events and draw polygons, and Im doing the drawing over an
image, so I have some off-screen double-buffering going on.
My drawing used to be really snappy, but with recent
versions of the java VM, Im lucky if it
In general terms, I'd say this;
- Draw in to an offscreen buffer
- your paint() method should simply blit the buffer to the screen
- issue repaint() after each draw you do and let awt handle the updating of the
screen. It will collapse multipe repaint requests if they are too frequent.
(from what
I have a similar application doing layout drawing for
an integrated circuit. One thing you may consider is
trying out different JDK's. The Sun JDK really isn't
always the best for drawing speed. I have a benchmark
test designed to stress-test the drawing speed.
The times I get per JDK can vary
Here's a trick I sometimes use to see what's getting repainted. I add a
button that calls a snow method on the JPanel subclass or whatever
you're using for your canvas:
public void snow() {
float snowFract = 0.25f;
Random rand = new Random();
int width = getWidth();
(Attachments to this list is not allowed?)
Find a test program inline below, which exposes problems in the Image I/O
libraries.
Running it against the following two TIFFs will in one case work, and not in
the other;
http://www.apache.org/~niclas/401505.tif
Hi Dan,
On Tue, Feb 01, 2005 at 09:27:21AM -0800, Dan Blanks wrote:
The Sun 1.5 JDK seems the obvious choice, but I
found to my dismay that the mouse events are
being handled differently. If I press the mouse
button, drag, then release, the 1.4 JDK's all
register mouse press, move,