package xui.projects.test.catchexit;
import net.xoetrope.optional.annotation.Find;
import net.xoetrope.swing.XButton;
import net.xoetrope.swing.XCheckbox;
import net.xoetrope.xui.XApplicationContext;
import net.xoetrope.xui.XPage;
public class Welcome extends XPage
{
@Find private XCheckbox exitJvmCB;
@Find private XButton exitBtn;
public Welcome()
{
}
public void pageCreated()
{
exitModeChanged();
}
public void doExit()
{
XApplicationContext appContext = project.getApplicationContext();
appContext.shutdown();
}
public void exitModeChanged()
{
// This mode will have no effect unless there is some background thread
// or some other UI element in existance. If there is nothing to do the
// JVM will just exit anyhow. An example of this is the use of a system
// tray icon which can be used to restart the application's UI if the
// JVM is still running. See the MetroBank example for more details.
project.setStartupParam( "ExitOnClose", exitJvmCB.isSelected() ? "true" : "false" );
}
}