• 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

JDialog &Modal.

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made my JDialog modal, but if I click on the JFrame that loaded the JDialog, the JDialog will still sit behind the JFrame, and the JFrame will be disabled. I guess this is the difference between a modal frame in Java, and VB.
How do I make this JDialog stay on the very front of the screen until it is closed? I was thinking of locking the mouse inside the frame so it can't move out but thats a little too forceful. Any help would be great thanks!
By the way, I'm using VisualAge for Java, and there is an option to make the JDialog modal, as well as the Bean that I place within the main frame. --i know this isn't a VisualAge discussion but....just in case that helps anyone out!
[ August 17, 2002: Message edited by: Brett Swift ]
 
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
http://java.sun.com/j2se/1.4/docs/api/javax/swing/JDialog.html
It often helps to read the API.
JDialog(Frame owner, String title, boolean modal)
Creates a modal or non-modal dialog with the specified title and the specified owner Frame.
"...I guess this is the difference between a modal frame in Java, and VB."
Is it? What is the difference? Oh, that VB doesn't give you the option for the Frame owner? Hmm, sounds like a limitation to me.
 
Brett Swift
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well thanks for the help bud..of course I read the API though! thats what I'm confused about.
in the creation of the frame, i have the line:
setModal(true);
..this locks up the parent frame..but you can still hide the modal dialog box.... when you click outside on the main application, this dialog still disappears behind the main application, and you have to minimize the application to find the JDialog, because it doesn't appear on the task manager.
thanks for your input though.
 
Gregg Bolinger
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
You still haven't specified the parent frame that the Dialog should be modal to. That is why it can go behind your frame. If you set the frame owner, it will stay in front of that frame like you want.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic