Window.close() not available

Hello!

I want to trigger the Window close action on a sub window in my application. For some reason though the window variable doesn’t seem to support that action… Meaning the IDE doesn’t show close() as a method option for the Window.
Eg.

Window windowObject = new Window();
windowObject.close();

→ Is displayed as faulty syntax.

I’ve used it in classes extending the Window class and there I can request the close() action.

Does anyone have any idea what I’m doing wring…? Are there contexts where the Window.close() action can’t be requested…?

Anyways, thanks!

/Max

Window.close() is protected so you cannot do that. I’d recommend you read
http://download.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
for a good tutorial about access modifiers in Java.

Ohh… well, that would explain it… seems like I then have to extend the Window class for all instances. Thanks!

If you want to close a sub window, you can do it by removing the window from parent:


parentWindow.removeWindow(window);

If you want to know if user closed the window you can add a CloseListener to the window by using the addListener method of Window.