Package xui.projects.test.catchexit

Source Code of xui.projects.test.catchexit.Welcome

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" );
    }

}
TOP

Related Classes of xui.projects.test.catchexit.Welcome

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.