I have been trying to update the code in an older Java Applet I created. It's a little tricky in that it has a main window and an option window that pops up when a user right clicks on the main window. I have been trying to change the code in the popup window to close the window when the user clicks the "X"
This is the original code:
public boolean handleEvent(Event evt)
{
if (evt.id == Event.WINDOW_DESTROY) hide();
return super.handleEvent(evt);
}
}
Here is one thing I am trying:
public void windowClosing(WindowEvent e) {
setVisible(false);
I have also tried:
public void addWindowListener(AWTEvent WindowEvent)
Not really sure what should work here...but I think the main problem I am having is that, as mentioned there are two windows and the main window class calls the option window which does not have a main (init) method.
Anybody??
Trouble Updating Java Applet - Post...
I have found a solution... can close this thread!
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
window.setVisible(false);
// displayMessage("Window closing", e);
}
}
);
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
window.setVisible(false);
// displayMessage("Window closing", e);
}
}
);
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.