aspose file tools*
The moose likes Applets and the fly likes Open window from JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Open window from JApplet" Watch "Open window from JApplet" New topic
Author

Open window from JApplet

Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
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.


SCJP1.4
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41812
    
  62
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.


Ping & DNS - my free Android networking tools app
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
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
Marshal

Joined: Mar 22, 2005
Posts: 41812
    
  62
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

Joined: Aug 21, 2004
Posts: 367
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

Joined: Aug 21, 2004
Posts: 367
Resolved!

I used an JFrame instead

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open window from JApplet