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

Discussion in 'Java' started by Dave Brown, Jul 9, 2005.

  1. Dave Brown

    Dave Brown Guest

    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.
    Dave Brown, Jul 9, 2005
    #1
    1. Advertising

  2. On Sat, 09 Jul 2005 10:59:37 +0100, Dave Brown wrote:

    > 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. ;-)

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
    Andrew Thompson, Jul 9, 2005
    #2
    1. Advertising

  3. Dave Brown

    Dave Brown Guest

    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 Thompson wrote:
    > On Sat, 09 Jul 2005 10:59:37 +0100, Dave Brown wrote:
    >
    >
    >>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. ;-)
    >
    Dave Brown, Jul 9, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bdb112
    Replies:
    45
    Views:
    1,316
    jazbees
    Apr 29, 2009
  2. Ross
    Replies:
    1
    Views:
    359
  3. Michael Tan
    Replies:
    32
    Views:
    929
    Ara.T.Howard
    Jul 21, 2005
  4. Replies:
    19
    Views:
    581
    Jeff Higgins
    Aug 10, 2012
  5. clusardi2k
    Replies:
    11
    Views:
    1,053
    Roedy Green
    Aug 9, 2012
Loading...

Share This Page