Example usage for java.awt SplashScreen SplashScreen

List of usage examples for java.awt SplashScreen SplashScreen

Introduction

In this page you can find the example usage for java.awt SplashScreen SplashScreen.

Prototype

SplashScreen(long ptr) 

Source Link

Usage

From source file:org.exist.launcher.Launcher.java

public Launcher(final String[] args) {
    if (SystemTray.isSupported()) {
        tray = SystemTray.getSystemTray();
    }//w w  w . j  a  v a 2s. com

    captureConsole();

    this.jettyConfig = getJettyConfig();
    final Optional<Path> eXistHome = ConfigurationHelper.getExistHome();
    final Path wrapperConfig;
    if (eXistHome.isPresent()) {
        wrapperConfig = eXistHome.get().resolve("tools/yajsw/conf/wrapper.conf");
    } else {
        wrapperConfig = Paths.get("tools/yajsw/conf/wrapper.conf");
    }

    wrapperProperties = new Properties();
    wrapperProperties.setProperty("wrapper.working.dir", eXistHome.orElse(Paths.get(".")).toString());
    wrapperProperties.setProperty("wrapper.config", wrapperConfig.toString());

    System.setProperty("wrapper.config", wrapperConfig.toString());

    installedAsService();

    boolean initSystemTray = true;
    if (isSystemTraySupported()) {
        initSystemTray = initSystemTray();
    }

    configDialog = new ConfigurationDialog(this::shutdown);

    splash = new SplashScreen(this);
    splash.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent windowEvent) {
            setServiceState();
            if (runningAsService.isPresent()) {
                splash.setStatus("eXist-db is already installed as service! Attaching to it ...");
                final Timer timer = new Timer(3000, (event) -> splash.setVisible(false));
                timer.setRepeats(false);
                timer.start();
            } else {
                if (ConfigurationUtility.isFirstStart()) {
                    splash.setVisible(false);
                    configDialog.open(true);
                    configDialog.requestFocus();
                } else {
                    startJetty();
                }
            }
        }
    });

    final boolean systemTrayReady = tray != null && initSystemTray && tray.getTrayIcons().length > 0;

    SwingUtilities.invokeLater(() -> utilityPanel = new UtilityPanel(Launcher.this, systemTrayReady));
}