• 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

JInternalFrame vs JDialog

 
Ranch Hand
Posts: 56
Tomcat Server Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to change my code from using a JDialog to using a JInternalFrame...

My problem is that when I do this, in code it will continue executing subsequent code if I use a JInternalFrame, but whilst I use the JDialog it waits for user response before continuing.

How would I use a JInternalFrame (without any buttons as you would have on a JDialog) and only continue execution of the code after it has been closed?

My current code:

 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Labuschagne:
I need to change my code from using a JDialog to using a JInternalFrame...

My problem is that when I do this, in code it will continue executing subsequent code if I use a JInternalFrame, but whilst I use the JDialog it waits for user response before continuing.



You can try something like:

JOptionPane.showInternalOptionDialog(this, djt.djPanel(), taskModel.getTaskName(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null);

If that doesn't suit your needs you can find various ways
of rolling your own if you look around on the net.
 
Michael Labuschagne
Ranch Hand
Posts: 56
Tomcat Server Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, tried that it works as an InternalFrame but I need it to be non-modal, is that possible, in a JOptionPane???
 
Brian Cole
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Labuschagne:
OK, tried that it works as an InternalFrame but I need it to be non-modal, is that possible, in a JOptionPane???



My mistake. But making it modal is the hard part. If you want non-modal then there are many ways you can do it. In your case, it might be easiest to replace your call to pane.createDialog() to pane.createInternalFrame(). (Don't forget to add() the internal frame to your JDesktopPane.)
 
Michael Labuschagne
Ranch Hand
Posts: 56
Tomcat Server Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tried your suggestion but keep getting the following error:

java.lang.IllegalArgumentException: illegal component position

I've modified the code and played around with it but still the same error.



Other internal frames are working correctly on this JDesktopPane not sure what the problem is.

How can I get it stop executing the rest of the code in the method untill the window is closed, or will it do that now anyway?

Thanks a lot, your help is appreciated!
 
Brian Cole
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Labuschagne:
Tried your suggestion but keep getting the following error:

java.lang.IllegalArgumentException: illegal component position




By illegal component position it doesn't mean the x-y position, but the index within the container. What container are you adding the JInternalFrame to? (It's not clear from your code what the type of this is, but I'm guessing it's not a JDesktopPane.)

btw, what's the motivation for using a JOptionPane instead of creating a JInternalFrame directly?

[edit: typo]
[ July 13, 2007: Message edited by: Brian Cole ]
 
Michael Labuschagne
Ranch Hand
Posts: 56
Tomcat Server Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm adding the JInternalFrame to a JDesktopPane (the class this code is in, extends JDektopPane)...

All I need is an InternalFrame that creates my Dialog which is non-Modal and stops executing successive code, after the InternalFrame deceleration until the frame is closed. JOptionPane waits for you to either close the frame or click OK, cancel and then continues executing code in the program how can I achieve this with JInternalFrame???

Thanks!
 
I was born with webbed fish toes. This tiny ad is my only friend:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic