You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Luiz Gustavo <lu...@gmail.com> on 2010/12/18 03:36:14 UTC
Exiting the application
Hi,
I have a menu item for exiting the application, and I use this action for
that:
Action.getNamedActions().put("exit", new Action() {
@Override
public void perform(Component source) {
for (int i = display.getLength() - 1; i >= 0; i--) {
Window window = (Window) display.get(i);
window.close();
}
System.exit(0);
}
});
Is it a good way of doing that or is there another better one, in which I
don't have to call System.exit(0)?
Re: Exiting the application
Posted by Luiz Gustavo <lu...@gmail.com>.
Thanks Greg!
2010/12/18 Greg Brown <gk...@verizon.net>
> You can call DesktopApplicationContext.exit() - that will make sure that
> your application's shutdown() method is called. Calling System.exit() will
> terminate the JVM immediately.
>
> On Dec 17, 2010, at 9:36 PM, Luiz Gustavo wrote:
>
> > Hi,
> >
> > I have a menu item for exiting the application, and I use this action for
> that:
> >
> > Action.getNamedActions().put("exit", new Action() {
> > @Override
> > public void perform(Component source) {
> > for (int i = display.getLength() - 1; i >= 0; i--) {
> > Window window = (Window) display.get(i);
> > window.close();
> > }
> > System.exit(0);
> > }
> > });
> >
> > Is it a good way of doing that or is there another better one, in which I
> don't have to call System.exit(0)?
> >
> >
>
>
--
Luiz Gustavo S. de Souza
http://luizgustavoss.wordpress.com
http://luizgustavoss.blogspot.com
http://twitter.com/lugustso
Re: Exiting the application
Posted by Greg Brown <gk...@verizon.net>.
You can call DesktopApplicationContext.exit() - that will make sure that your application's shutdown() method is called. Calling System.exit() will terminate the JVM immediately.
On Dec 17, 2010, at 9:36 PM, Luiz Gustavo wrote:
> Hi,
>
> I have a menu item for exiting the application, and I use this action for that:
>
> Action.getNamedActions().put("exit", new Action() {
> @Override
> public void perform(Component source) {
> for (int i = display.getLength() - 1; i >= 0; i--) {
> Window window = (Window) display.get(i);
> window.close();
> }
> System.exit(0);
> }
> });
>
> Is it a good way of doing that or is there another better one, in which I don't have to call System.exit(0)?
>
>