• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serious Problem with JDialog NOT A MODAL for ...

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Developers,
we are having a serious problem , in using the swings . We are using the JDialog a container for the screens in our application , application is using DB2 in the backend. So the problem is every application has several FORM screen where user has to add,Edit and delete the data, so there are many heavy Manipulation and Database operations involved on the startup of every screen ( this is our requirement , cant get rid of it) .
So where ever user clicks the " ADD RECORD " button very fast (like double clicking) either , the next screen (which is involved with several DB operations on startup) appears in TWO or more instances (how many times the clicking was done ) despite the JDialog's MODAL property is set.
We have tried every thing to stop this, bus we are failed to do so, Except by stoping is manually by applying some flags in the code for every form (u can imagine we have 2230 classes and 80% of them are GUIs)
We tried even :
Starting the GUI in a separate worker thread and using
SwingUtilities.startAnd Wait() method.
Also many ways to handle it from the ActionListeners, and from these type of all possibilities
So please help us out in this matter and let us know if any one have any solution about the problem.
We will be thankful to the person /Team /Organization.
The Saint
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey er uh TheSaint,
Hey padner if you want to keep gettin help hyere at the ranch you need to change your display name as per the naming policy at JavaRanch.
Now for your problem. I'm not real clear on your archictechture. Do you have a central object that generates the JDialogs or does each dialog generate the next one in the chain? It would be better to have a central object to create the dialogs. Have you tried using a javax.swing.Timer to lock out (disable) the ADD button for a reasonable (1000 milliseconds?) amount of time. In other words, once actionPerformed is called on the ADD button, start the timer and ignore any further clicks until the timer fires.
Hope this helps,
Michael Morris
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"TheSaint" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

(Michael Morris' idea sounds like a really good solution... )

Thanks! and welcome to the JavaRanch!
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, here is my suggestion. Use the Singleton Method when instantiated/invoking your next JDialog Form. Something like this:

then in your action Listener you do this

This way, no matter how many times the Button is clicked, it will always return theOnlyForm1 therefor only 1 JDialog.
Hope that helps a little.
reply
    Bookmark Topic Watch Topic
  • New Topic