|
-
February 29th, 2000, 06:08 PM
#1
Close Button Not Working
How come sometimes the close buttons, the "x" on the top right corner on the forms aren't responding? I'm very sure the forms are working well coz I made a command button that closes the application. Any solution to this? Thanx
-
March 2nd, 2000, 10:46 AM
#2
Re: Close Button Not Working
You have to be a component listener to the frame/dialog and use this
public void componentClosed(ComponentEvent e)
{
hide();
}
keith
-
March 2nd, 2000, 01:20 PM
#3
Re: Close Button Not Working
Or you may create your own frame class and use it instead of Frame. Do this:
class MyFrame extends Frame
{
public boolean handleEvent(Event e) {
if(e.id==Event.WINDOW_DESTROY) {
dispose();
}
}
}
Good luck, ytsau
-
March 2nd, 2000, 01:26 PM
#4
Re: Close Button Not Working
Or you may create your own frame class and use it instead of Frame. Do this:
class MyApplet extends Applet
{
MyFrame frame;
init()
{
frame = new MyFrame();
frame.show();
}
public boolean action(Event e, Object o) {
if(e.target==mybutton) {
frame.dispose();
}
}
class MyFrame extends Frame
{
public boolean handleEvent(Event e) {
if(e.id==Event.WINDOW_DESTROY) {
dispose();
}
}
}
The applet will create a new frame. It can be closed by clicking its [x], or you can click your button named mybutton to close it. Good luck, ytsau
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|