tags:

views:

138

answers:

2

Hi I have created two jdialog box. from first jdialog box i call to second jdialog box. I have arranged my component at the center. But when i click on next button my program calls the second jdialog but within that period (for a fraction of second i found some flickering effect means some jdialog is displayed at the left top of my screen. its for fraction of second. I think it may be flickering effect. so how to avoid this problem.

Thanks Sunil KUmar Sahoo

+1  A: 

If one dialog opens another, it might make more sense to use something like a Wizard instead. Then you avoid flickering altogether as you would change the contents on the component of the one and only dialog that you show on the screen.

The downside is that, of course, it will be a little bit harder to implement, but not much.

The following link contains the information about creating a wizard:

http://java.sun.com/developer/technicalArticles/GUI/swing/wizard/

Mario Ortegón
+1  A: 

You probably display the second dialog before you set its location. So instead of doing :

dialog.setVisible(true);
dialog.setLocationRelativeTo(null);

do this :

dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
Savvas Dalkitsis