• 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

How to make sure JDialog will always be in front (with 2 or more JDialogs)

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

* H.E.L.P *

Dialog, in most cases, requires the user to address a specific issue (YES/NO, CONFIRM, etc). They also block the user from doing anything else but addressing the dialog FIRST (you cannot click the menu item before you �got rid of� the dialog).

This is simply great as I can build my own dialogs and make sure that the user can access only one �record� at a time (a record is just a collection of information on a dialog with 2 buttons: EXIT and UPDATE).

This is working just great, my users are searching for information and by double clicking the info they want they can access the record (if they change something they can update it and exit).

THE PROBLEM:
Well, after 5 months I realized that I had a critical mistake: if the user double clicks on a record and the record is open (now there are 2 frames: the main frame and the dialog) AND the user, for some reason, switches to a different application (say: MS outlook) and returns to the Java application � the dialog (record) is BEHIND the main frame. That means that the user CANNOT do anything (most of them reset the computer). ALSO, from the �record� they can open a new window (again dialog) and this cannot be accessed.

Any idea how to make sure the dialog will always be at the front?

This is my code:
if (e.getClickCount() == 2)
{
JFrame tmp = new JFrame();
JDialog editor=new JDialog(tmp,"Editor",true);
Record tmpRec = (Record) model.getElementAt(aTable.getSelectedRow());
DirectEdit direct = new DirectEdit(editor, tmpRec.getKEY());
direct.showDialog();
}
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic