Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JDialog &Modal.

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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.
    Bookmark Topic Watch Topic
  • New Topic