JDialog.setVisible(true); taking several seconds to display

D

Dave Brown

Hi All,

Just wondering if anyone can give me any pointers as to why my dialog is
taking too long to display, its a very basic dialog, a dozen textboxes
and labels and thats it. I'm displaying it modally with this code...

private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {

LocationDLG dlg;
dlg = new
LocationDLG((javax.swing.JFrame)this.getTopLevelAncestor(),true);
if (dlg.doModal()) {
RefreshLocations();
}
dlg.dispose();
}


in dlg.doModal() is the code that sets visible to true ;

public boolean doModal() {
setVisible(true);
return retval;
}


once it gets to the setvisible line, debugging over that is what takes
up to 6 seconds. Far too long just for a simple dialog it seems.

Any advice appreciated.


Thanks,

Dave.
 
A

Andrew Thompson

Just wondering if anyone can give me any pointers as to why my dialog is
taking too long to display, its a very basic dialog, a dozen textboxes
and labels and thats it. I'm displaying it modally with this code...

private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {

LocationDLG dlg;
dlg = new
LocationDLG((javax.swing.JFrame)this.getTopLevelAncestor(),true);

You can prepare the dialog after the GUI becomes visible in a
separate thread in the background. That way, it can be ready
to setVisible(true) when the user requires it.
if (dlg.doModal()) {
RefreshLocations();

What does that do? 100,000 separate D/B transactions? [1]
once it gets to the setvisible line, debugging over that is what takes
up to 6 seconds.

'debugging over that is what takes..'?? What does that mean?
..Far too long just for a simple dialog it seems.

Any advice appreciated.

- Supply a self contained (SHORT) example that demonstrates
this behaviour.
- Supply said example to the GUI experts on c.l.j.gui.

[1] OK - cheap shot given it is called after the dialog
returns. I just couldn't resist. ;-)
 
D

Dave Brown

Thanks for replying Andrew,

The building of dialog is almost instanteanous, The delay is just on
the setVisible();

I havent used the c.l.j.gui newsgroup before, didnt realise it was there
so I've posted on there.

Thanks again,

Dave.


Andrew said:
Just wondering if anyone can give me any pointers as to why my dialog is
taking too long to display, its a very basic dialog, a dozen textboxes
and labels and thats it. I'm displaying it modally with this code...

private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {

LocationDLG dlg;
dlg = new
LocationDLG((javax.swing.JFrame)this.getTopLevelAncestor(),true);


You can prepare the dialog after the GUI becomes visible in a
separate thread in the background. That way, it can be ready
to setVisible(true) when the user requires it.

if (dlg.doModal()) {
RefreshLocations();


What does that do? 100,000 separate D/B transactions? [1]

once it gets to the setvisible line, debugging over that is what takes
up to 6 seconds.


'debugging over that is what takes..'?? What does that mean?

..Far too long just for a simple dialog it seems.

Any advice appreciated.


- Supply a self contained (SHORT) example that demonstrates
this behaviour.
- Supply said example to the GUI experts on c.l.j.gui.

[1] OK - cheap shot given it is called after the dialog
returns. I just couldn't resist. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top