Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open window from JApplet

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

i want to open a window from a JApplet. Not window.open in javascript but a new JFrame or JWindow. How can this be accomplished? I've seen a lot of "warning applet window" when I browse around.

Here's what I've done so far.

Code in my applet.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code looks OK. Does it not work?

You can get rid of the warning message by digitally signing the applet, but otherwise it's just a regular feature of applet windows. They're meant to alert the user that this window is not one opened by a local application, but by a potentially untrusted remote applet.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

No, the code does not work! Must I open the window on a event? If this is the case why? can I get around it?

// Mathias
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the code is getting executed, then the window should be visible, no matter whether it's during event handling or startup. In which method do you have this code?

I'm not sure what happens if you pack a window that contains no components; it might get reduced to a 1x1-sized window. Try leaving out the pack call, or add some non-reducible components to it.
[ November 15, 2005: Message edited by: Ulf Dittmer ]
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf!

I have actually a JLabel in before I pack(). I have tested it in the JApplets start(), init(), paint() method

// Mathias
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolved!

I used an JFrame instead

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic