Hi,
In my application I have a window with no functional button to close it,
I'm relying on the closing button provided by the window manager. When the
user closes the window I want to display a (bit annoying) confirmation
JOptionPane.
In UISpec4J, the method to close a window when no functional button is
"dispose()" (which call the dispose() method on the actual window). My
problem is that I'm displaying the message window on WindowClosing event
which is not generated when calling dispose().
My solution is to generate a WindowClosing event myself like this:
private void closeWindow(final org.uispec4j.Window window) {
final Container container = window.getAwtComponent();
final WindowEvent event = new WindowEvent((java.awt.Window) container,
WindowEvent.WINDOW_CLOSING);
for (final WindowListener listener :
container.getListeners(WindowListener.class)) {
listener.windowClosing(event);
}
}
I'm wondering if that kind of function should be added in uispec4j
(org.uispec4j.Window.close() for instance). What do you think of it?
Cheers,
Laurent.