Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Applet question

 
Chris Tjoumas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have converted a stand-alone application into an applet. There are many things in my application that popup dialogs (thread activity, login dialogs, etc), but of course a JDialog takes a Frame as it's owner. Can I get to a JApplet's Frame object (or does it have one)?
Basically, I just want to center JDialog's in my JApplet...any help is appreciated!
Thanks,
Chris
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't worked with applets in a while, but I don't think it is possible to have a modal dialog in an applet for exactly this reason, an applet doesn't have a frame. The workaround I used was to use a LayerdPane and JInternalFrame or JInternalDialog to display a dialog within an applet, but on top of the application. Check it out:
Java Tutorial: Layered Panes
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting this to work with an applet... you just pass a reference of the applet to SwingUtilities.windowForComponent() and cast the result to a Frame. I'm using the Java 1.4.2 plugin and have tried it both in MS IE 6 and Mozilla Firebird.
 
Chris Tjoumas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually couldn't get that to work. I don't really need it anymore as I've taken out all popup windows - but it'd still be nice to know
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!