[4230] in java-interest
Re: Menubars
daemon@ATHENA.MIT.EDU (Gary Aitken)
Thu Dec 14 02:47:34 1995
Date: Wed, 13 Dec 1995 22:24:34 -0700
From: garya@village.org (Gary Aitken)
To: robertf@sshare.com (Robert Fox), java-interest@java.sun.com
In-Reply-To: <9512121801.AA18466@sshare.com>
>I am using Netscape to view my applets... I have created a Frame and attached
>a MenuBar to it... Netscape spawns a window with a frame, but I cannot
>close the frame (using the system menu->Exit or hitting the 'X' in upper
>right doesn't work!). The only way I have found to destroy the frame is
>by closing Netscape! Does anyone know how to get around this? Or is this
>simply a bug in Netscape...
import java.awt.*;
I'm not positive about this, and don't have time to test it right now, but
I think if instead of using a Frame you use a subclass of Frame, override
handle_event, and process the window destroy you can solve your problem:
public class MainWindow extends Frame {
public MainWindow(
String title) // Text for title bar of window
{
super( title );
}
public boolean handleEvent(
Event e) // Event to process
{
// Local Variables
boolean ret; // return value
switch (e.id) {
case (Event.WINDOW_DESTROY): // Window was destroyed
hide();
ret = True;
break;
default:
ret = super.handleEvent(e);
break;
}
return ( ret );
}
}
Gary Aitken garya@village.org
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com