tags:

views:

131

answers:

3

I've just started making my first GUI application in Java and I decided to use the NetBeans IDE to do it. I think its working fine so far, except for one problem; it seems to be slow updating the content of a window.

Even in very simple windows with few controls I find that when - for example - closing or resizing a window, I get the normal window border working properly but the inside is completely see through for a second.

It's not the biggest deal in the world, I just find it mildly annoying.

EDIT: I've tried the HelloWorldSwing from the official Java tutorial but I have the same issue, only now, when resizing, instead of being transparent, the new area of the window is black until the contents updates.

+1  A: 

You should ensure that all of your GUI updates are performed in the Event Dispatch Thread, and that any other long running tasks are performed in worker threads. If you have long running tasks running in the EDT, your GUI will feel sluggish. Take a look at this tutorial for concepts on Swing Threading.

akf
Thing is though, it's just a hollow gui at the moment. I built it using the IDE so I haven't even started writing any code yet.
ChrisD
+1  A: 

In the absence of any technical problems with your app, this could simply be JVM warmup effects. Do updates speed up if you resize the window a few times?

Stephen C
I've found that if I keep keep resizing without releasing the mouse button, it eventually works ok. However as soon as I release the mouse button and then start resizing again I get the same problem.
ChrisD
+1  A: 

This could be a Java2D hardware accelleration issue. Is your 3D graphics card driver fully updated?

Thorbjørn Ravn Andersen