Example usage for java.awt SplashScreen getSplashScreen

List of usage examples for java.awt SplashScreen getSplashScreen

Introduction

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

Prototype

public static SplashScreen getSplashScreen() 

Source Link

Document

Returns the SplashScreen object used for Java startup splash screen control on systems that support display.

Usage

From source file:com.brainflow.application.toplevel.Brainflow.java

private void splashMessage(String message) {
    Graphics2D g = SplashScreen.getSplashScreen().createGraphics();
    //g.setComposite(AlphaComposite.Clear);
    //g.fillRect(20,430,100,460);
    //g.setPaintMode();
    g.setColor(Color.WHITE);/*from  w  w w .  j a v a2s . com*/
    g.setFont(new Font("helvetica", Font.PLAIN, 16));
    g.drawString(message, 20, 430);
    SplashScreen.getSplashScreen().update();

}

From source file:brainflow.app.toplevel.BrainFlow.java

private void openSplash() {
    splash = SplashScreen.getSplashScreen();
    if (splash == null) {
        log.warning("Error: no splash image specified on the command line");
        return;// w  w  w  .j  a v  a2 s. c  o  m
    }

    // compute base positions for text and progress bar
    Dimension splashSize = splash.getSize();
    textY = splashSize.height - 20;
    barY = splashSize.height - 30;

    splashGraphics = splash.createGraphics();
}

From source file:com.devbury.desktoplib.systemtray.SystemTrayApplication.java

protected SplashScreen newSplashScreen() {
    return SplashScreen.getSplashScreen();
}

From source file:com.ssn.app.loader.SplashDemo.java

/**
 * Prepare the global variables for the other splash functions
 *//*from  ww  w .  j  a v a  2  s.com*/
private static void splashInit() {
    logger.debug("Start splashInit() ");
    mySplash = SplashScreen.getSplashScreen();

    if (mySplash != null) { // if there are any problems displaying the splash this will be null
        Dimension ssDim = mySplash.getSize();
        int height = ssDim.height;
        int width = ssDim.width;
        // stake out some area for our status information
        splashTextArea = new Rectangle2D.Double(width / 2 + 80, height / 2 - 130, width * .27, 25.);
        splashProgressArea = new Rectangle2D.Double(width / 2 - 253, height - 129, width / 2 + 163, 3);
        splashRightsArea = new Rectangle2D.Double(width / 2 - 240, height / 2 + 110, width * .27, 25.);
        splashVersionArea = new Rectangle2D.Double(width / 2 - 240, height / 2 - 110, width * .27, 25.);
        splashPercentArea = new Rectangle2D.Double(width / 2 - 13, height / 2 + 60, width * .27, 25.);
        splashLoadingArea = new Rectangle2D.Double(width / 2 - 240, height / 2 - 110, width * .27, 25.);
        // create the Graphics environment for drawing status info
        splashGraphics = mySplash.createGraphics();
        font1 = new Font("open sans", Font.PLAIN, 11);
        font2 = new Font("open sans", Font.PLAIN, 10);

        splashGraphics.setFont(font1);
        splashGraphics.setFont(font2);

        // initialize the status info
        splashProgress(0);
    }
}

From source file:de.lazyzero.kkMulticopterFlashTool.KKMulticopterFlashTool.java

public KKMulticopterFlashTool(String[] args) {

    kk = this;//from  w w  w .  j a  va2s. c om
    evaluateCommandlineOptions(args);

    //check if the OS is Mac OS X
    if (System.getProperty("os.name").toLowerCase().contains("mac")) {
        SETTINGS_FILE = new File(System.getProperty("user.home") + "/Library/Preferences/",
                "kkMulticopterFlashTool.properties");
        LOG_FILE = new File(getTempFolder(), "kkLogging.txt");
    }

    if (!isNoLogging)
        initLogger();

    SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) {
        logger.log(Level.INFO, "Splash not loaded.");
    }

    logger.log(Level.INFO, System.getProperty("user.home"));
    logger.log(Level.INFO, System.getProperty("os.name"));

    loadSettings();
    loadTranslation();

    Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            saveSettings();
        }
    });

    firmwareReader = new XmlReaderFirmwares(firmwareRepositoryURL);

    this.init();
    if (enableTweak)
        ColorTweaks.tweakColors();
    this.initGUI();

    this.addPropertyChangeListener(this);

    checkVersion();
}

From source file:processing.app.Base.java

public Base(String[] args) throws Exception {
    Thread deleteFilesOnShutdownThread = new Thread(DeleteFilesOnShutdown.INSTANCE);
    deleteFilesOnShutdownThread.setName("DeleteFilesOnShutdown");
    Runtime.getRuntime().addShutdownHook(deleteFilesOnShutdownThread);

    BaseNoGui.initLogger();/*  www  .  j  a va 2  s .  c o m*/

    initLogger();

    BaseNoGui.initPlatform();

    BaseNoGui.getPlatform().init();

    BaseNoGui.initPortableFolder();

    // Look for a possible "--preferences-file" parameter and load preferences
    BaseNoGui.initParameters(args);

    CommandlineParser parser = new CommandlineParser(args);
    parser.parseArgumentsPhase1();
    commandLine = !parser.isGuiMode();

    BaseNoGui.checkInstallationFolder();

    // If no path is set, get the default sketchbook folder for this platform
    if (BaseNoGui.getSketchbookPath() == null) {
        File defaultFolder = getDefaultSketchbookFolderOrPromptForIt();
        if (BaseNoGui.getPortableFolder() != null)
            PreferencesData.set("sketchbook.path", BaseNoGui.getPortableSketchbookFolder());
        else
            PreferencesData.set("sketchbook.path", defaultFolder.getAbsolutePath());
        if (!defaultFolder.exists()) {
            defaultFolder.mkdirs();
        }
    }

    SplashScreenHelper splash;
    if (parser.isGuiMode()) {
        // Setup all notification widgets
        splash = new SplashScreenHelper(SplashScreen.getSplashScreen());
        BaseNoGui.notifier = new GUIUserNotifier(this);

        // Setup the theme coloring fun
        Theme.init();
        System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true"));

        // Set the look and feel before opening the window
        try {
            BaseNoGui.getPlatform().setLookAndFeel();
        } catch (Exception e) {
            // ignore
        }

        // Use native popups so they don't look so crappy on osx
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    } else {
        splash = new SplashScreenHelper(null);
    }

    splash.splashText(tr("Loading configuration..."));

    BaseNoGui.initVersion();

    // Don't put anything above this line that might make GUI,
    // because the platform has to be inited properly first.

    // Create a location for untitled sketches
    untitledFolder = FileUtils.createTempFolder("untitled" + new Random().nextInt(Integer.MAX_VALUE), ".tmp");
    DeleteFilesOnShutdown.add(untitledFolder);

    splash.splashText(tr("Initializing packages..."));
    BaseNoGui.initPackages();

    splash.splashText(tr("Preparing boards..."));

    if (!isCommandLine()) {
        rebuildBoardsMenu();
        rebuildProgrammerMenu();
    } else {
        TargetBoard lastSelectedBoard = BaseNoGui.getTargetBoard();
        if (lastSelectedBoard != null)
            BaseNoGui.selectBoard(lastSelectedBoard);
    }

    // Setup board-dependent variables.
    onBoardOrPortChange();

    pdeKeywords = new PdeKeywords();
    pdeKeywords.reload();

    contributionInstaller = new ContributionInstaller(BaseNoGui.getPlatform(),
            new GPGDetachedSignatureVerifier());
    libraryInstaller = new LibraryInstaller(BaseNoGui.getPlatform());

    parser.parseArgumentsPhase2();

    // Save the preferences. For GUI mode, this happens in the quit
    // handler, but for other modes we should also make sure to save
    // them.
    if (parser.isForceSavePrefs()) {
        PreferencesData.save();
    }

    if (parser.isInstallBoard()) {
        ContributionsIndexer indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder(),
                BaseNoGui.getHardwareFolder(), BaseNoGui.getPlatform(), new GPGDetachedSignatureVerifier());
        ProgressListener progressListener = new ConsoleProgressListener();

        List<String> downloadedPackageIndexFiles = contributionInstaller.updateIndex(progressListener);
        contributionInstaller.deleteUnknownFiles(downloadedPackageIndexFiles);
        indexer.parseIndex();
        indexer.syncWithFilesystem();

        String[] boardToInstallParts = parser.getBoardToInstall().split(":");

        ContributedPlatform selected = null;
        if (boardToInstallParts.length == 3) {
            selected = indexer.getIndex().findPlatform(boardToInstallParts[0], boardToInstallParts[1],
                    VersionHelper.valueOf(boardToInstallParts[2]).toString());
        } else if (boardToInstallParts.length == 2) {
            List<ContributedPlatform> platformsByName = indexer.getIndex().findPlatforms(boardToInstallParts[0],
                    boardToInstallParts[1]);
            Collections.sort(platformsByName, new DownloadableContributionVersionComparator());
            if (!platformsByName.isEmpty()) {
                selected = platformsByName.get(platformsByName.size() - 1);
            }
        }
        if (selected == null) {
            System.out.println(tr("Selected board is not available"));
            System.exit(1);
        }

        ContributedPlatform installed = indexer.getInstalled(boardToInstallParts[0], boardToInstallParts[1]);

        if (!selected.isBuiltIn()) {
            contributionInstaller.install(selected, progressListener);
        }

        if (installed != null && !installed.isBuiltIn()) {
            contributionInstaller.remove(installed);
        }

        System.exit(0);

    } else if (parser.isInstallLibrary()) {
        BaseNoGui.onBoardOrPortChange();

        ProgressListener progressListener = new ConsoleProgressListener();
        libraryInstaller.updateIndex(progressListener);

        LibrariesIndexer indexer = new LibrariesIndexer(BaseNoGui.getSettingsFolder());
        indexer.parseIndex();
        indexer.setLibrariesFolders(BaseNoGui.getLibrariesFolders());
        indexer.rescanLibraries();

        for (String library : parser.getLibraryToInstall().split(",")) {
            String[] libraryToInstallParts = library.split(":");

            ContributedLibrary selected = null;
            if (libraryToInstallParts.length == 2) {
                selected = indexer.getIndex().find(libraryToInstallParts[0],
                        VersionHelper.valueOf(libraryToInstallParts[1]).toString());
            } else if (libraryToInstallParts.length == 1) {
                List<ContributedLibrary> librariesByName = indexer.getIndex().find(libraryToInstallParts[0]);
                Collections.sort(librariesByName, new DownloadableContributionVersionComparator());
                if (!librariesByName.isEmpty()) {
                    selected = librariesByName.get(librariesByName.size() - 1);
                }
            }
            if (selected == null) {
                System.out.println(tr("Selected library is not available"));
                System.exit(1);
            }

            Optional<ContributedLibrary> mayInstalled = indexer.getIndex()
                    .getInstalled(libraryToInstallParts[0]);
            if (mayInstalled.isPresent() && selected.isIDEBuiltIn()) {
                System.out.println(tr(I18n.format(
                        "Library {0} is available as built-in in the IDE.\nRemoving the other version {1} installed in the sketchbook...",
                        library, mayInstalled.get().getParsedVersion())));
                libraryInstaller.remove(mayInstalled.get(), progressListener);
            } else {
                libraryInstaller.install(selected, mayInstalled, progressListener);
            }
        }

        System.exit(0);

    } else if (parser.isVerifyOrUploadMode()) {
        // Set verbosity for command line build
        PreferencesData.setBoolean("build.verbose", parser.isDoVerboseBuild());
        PreferencesData.setBoolean("upload.verbose", parser.isDoVerboseUpload());

        // Set preserve-temp flag
        PreferencesData.setBoolean("runtime.preserve.temp.files", parser.isPreserveTempFiles());

        // Make sure these verbosity preferences are only for the current session
        PreferencesData.setDoSave(false);

        Sketch sketch = null;
        String outputFile = null;

        try {
            // Build
            splash.splashText(tr("Verifying..."));

            File sketchFile = BaseNoGui.absoluteFile(parser.getFilenames().get(0));
            sketch = new Sketch(sketchFile);

            outputFile = new Compiler(sketch).build(progress -> {
            }, false);
        } catch (Exception e) {
            // Error during build
            e.printStackTrace();
            System.exit(1);
        }

        if (parser.isUploadMode()) {
            // Upload
            splash.splashText(tr("Uploading..."));

            try {
                List<String> warnings = new ArrayList<>();
                UploaderUtils uploader = new UploaderUtils();
                boolean res = uploader.upload(sketch, null, outputFile, parser.isDoUseProgrammer(),
                        parser.isNoUploadPort(), warnings);
                for (String warning : warnings) {
                    System.out.println(tr("Warning") + ": " + warning);
                }
                if (!res) {
                    throw new Exception();
                }
            } catch (Exception e) {
                // Error during upload
                System.out.flush();
                System.err.flush();
                System.err.println(tr("An error occurred while uploading the sketch"));
                System.exit(1);
            }
        }

        // No errors exit gracefully
        System.exit(0);
    } else if (parser.isGuiMode()) {
        splash.splashText(tr("Starting..."));

        for (String path : parser.getFilenames()) {
            // Correctly resolve relative paths
            File file = absoluteFile(path);

            // Fix a problem with systems that use a non-ASCII languages. Paths are
            // being passed in with 8.3 syntax, which makes the sketch loader code
            // unhappy, since the sketch folder naming doesn't match up correctly.
            // http://dev.processing.org/bugs/show_bug.cgi?id=1089
            if (OSUtils.isWindows()) {
                try {
                    file = file.getCanonicalFile();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            if (!parser.isForceSavePrefs())
                PreferencesData.setDoSave(true);
            if (handleOpen(file, retrieveSketchLocation(".default"), false) == null) {
                String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
                // Open failure is fatal in upload/verify mode
                if (parser.isVerifyOrUploadMode())
                    showError(null, mess, 2);
                else
                    showWarning(null, mess, null);
            }
        }

        installKeyboardInputMap();

        // Check if there were previously opened sketches to be restored
        restoreSketches();

        // Create a new empty window (will be replaced with any files to be opened)
        if (editors.isEmpty()) {
            handleNew();
        }

        new Thread(new BuiltInCoreIsNewerCheck(this)).start();

        // Check for boards which need an additional core
        new Thread(new NewBoardListener(this)).start();

        // Check for updates
        if (PreferencesData.getBoolean("update.check")) {
            new UpdateCheck(this);

            contributionsSelfCheck = new ContributionsSelfCheck(this,
                    new UpdatableBoardsLibsFakeURLsHandler(this), contributionInstaller, libraryInstaller);
            new Timer(false).schedule(contributionsSelfCheck,
                    Constants.BOARDS_LIBS_UPDATABLE_CHECK_START_PERIOD);
        }

    } else if (parser.isNoOpMode()) {
        // Do nothing (intended for only changing preferences)
        System.exit(0);
    } else if (parser.isGetPrefMode()) {
        BaseNoGui.dumpPrefs(parser);
    } else if (parser.isVersionMode()) {
        System.out.println("Arduino: " + BaseNoGui.VERSION_NAME_LONG);
        System.exit(0);
    }
}

From source file:jatoo.app.App.java

public App(final String title) {

    this.title = title;

    ///*from www  .ja v  a  2 s .  c  om*/
    // load properties

    properties = new AppProperties(new File(getWorkingDirectory(), "app.properties"));
    properties.loadSilently();

    //
    // resources

    texts = new ResourcesTexts(getClass(), new ResourcesTexts(App.class));
    images = new ResourcesImages(getClass(), new ResourcesImages(App.class));

    //
    // create & initialize the window

    if (isDialog()) {

        window = new JDialog((Frame) null, getTitle());

        if (isUndecorated()) {
            ((JDialog) window).setUndecorated(true);
            ((JDialog) window).setBackground(new Color(0, 0, 0, 0));
        }

        ((JDialog) window).setResizable(isResizable());
    }

    else {

        window = new JFrame(getTitle());

        if (isUndecorated()) {
            ((JFrame) window).setUndecorated(true);
            ((JFrame) window).setBackground(new Color(0, 0, 0, 0));
        }

        ((JFrame) window).setResizable(isResizable());
    }

    window.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(final WindowEvent e) {
            System.exit(0);
        }

        @Override
        public void windowIconified(final WindowEvent e) {
            if (isHideWhenMinimized()) {
                hide();
            }
        }
    });

    //
    // set icon images
    // is either all icons from initializer package
    // or all icons from app package

    List<Image> windowIconImages = new ArrayList<>();
    String[] windowIconImagesNames = new String[] { "016", "020", "022", "024", "032", "048", "064", "128",
            "256", "512" };

    for (String size : windowIconImagesNames) {
        try {
            windowIconImages.add(new ImageIcon(getClass().getResource("app-icon-" + size + ".png")).getImage());
        } catch (Exception e) {
        }
    }

    if (windowIconImages.size() == 0) {

        for (String size : windowIconImagesNames) {
            try {
                windowIconImages
                        .add(new ImageIcon(App.class.getResource("app-icon-" + size + ".png")).getImage());
            } catch (Exception e) {
            }
        }
    }

    window.setIconImages(windowIconImages);

    //
    // this is the place for to call init method
    // after all local components are created
    // from now (after init) is only configuration

    init();

    //
    // set content pane ( and ansure transparency )

    JComponent contentPane = getContentPane();
    contentPane.setOpaque(false);

    ((RootPaneContainer) window).setContentPane(contentPane);

    //
    // pack the window right after the set of the content pane

    window.pack();

    //
    // center window (as default in case restore fails)
    // and try to restore the last location

    window.setLocationRelativeTo(null);
    window.setLocation(properties.getLocation(window.getLocation()));

    if (!isUndecorated()) {

        if (properties.getLastUndecorated(isUndecorated()) == isUndecorated()) {

            if (isResizable() && isSizePersistent()) {

                final String currentLookAndFeel = String.valueOf(UIManager.getLookAndFeel());

                if (properties.getLastLookAndFeel(currentLookAndFeel).equals(currentLookAndFeel)) {
                    window.setSize(properties.getSize(window.getSize()));
                }
            }
        }
    }

    //
    // fix location if out of screen

    Rectangle intersection = window.getGraphicsConfiguration().getBounds().intersection(window.getBounds());

    if ((intersection.width < window.getWidth() * 1 / 2)
            || (intersection.height < window.getHeight() * 1 / 2)) {
        UIUtils.setWindowLocationRelativeToScreen(window);
    }

    //
    // restore some properties

    setAlwaysOnTop(properties.isAlwaysOnTop());
    setHideWhenMinimized(properties.isHideWhenMinimized());
    setTransparency(properties.getTransparency(transparency));

    //
    // null is also a good value for margins glue gaps (is [0,0,0,0])

    Insets marginsGlueGaps = getMarginsGlueGaps();
    if (marginsGlueGaps == null) {
        marginsGlueGaps = new Insets(0, 0, 0, 0);
    }

    //
    // glue to margins on Ctrl + ARROWS

    if (isGlueToMarginsOnCtrlArrows()) {

        UIUtils.setActionForCtrlDownKeyStroke(((RootPaneContainer) window).getRootPane(),
                new ActionGlueMarginBottom(window, marginsGlueGaps.bottom));
        UIUtils.setActionForCtrlLeftKeyStroke(((RootPaneContainer) window).getRootPane(),
                new ActionGlueMarginLeft(window, marginsGlueGaps.left));
        UIUtils.setActionForCtrlRightKeyStroke(((RootPaneContainer) window).getRootPane(),
                new ActionGlueMarginRight(window, marginsGlueGaps.right));
        UIUtils.setActionForCtrlUpKeyStroke(((RootPaneContainer) window).getRootPane(),
                new ActionGlueMarginTop(window, marginsGlueGaps.top));
    }

    //
    // drag to move ( when provided component is not null )

    JComponent dragToMoveComponent = getDragToMoveComponent();

    if (dragToMoveComponent != null) {

        //
        // move the window by dragging the UI component

        int marginsGlueRange = Math.min(window.getGraphicsConfiguration().getBounds().width,
                window.getGraphicsConfiguration().getBounds().height);
        marginsGlueRange /= 60;
        marginsGlueRange = Math.max(marginsGlueRange, 15);

        UIUtils.forwardDragAsMove(dragToMoveComponent, window, marginsGlueRange, marginsGlueGaps);

        //
        // window popup

        dragToMoveComponent.addMouseListener(new MouseAdapter() {
            public void mouseReleased(final MouseEvent e) {
                if (SwingUtilities.isRightMouseButton(e)) {
                    windowPopup = getWindowPopup(e.getLocationOnScreen());
                    windowPopup.setVisible(true);
                }
            }
        });

        //
        // always dispose the popup when window lose the focus

        window.addFocusListener(new FocusAdapter() {
            public void focusLost(final FocusEvent e) {
                if (windowPopup != null) {
                    windowPopup.setVisible(false);
                    windowPopup = null;
                }
            }
        });
    }

    //
    // tray icon

    if (hasTrayIcon()) {

        if (SystemTray.isSupported()) {

            Image trayIconImage = windowIconImages.get(0);
            Dimension trayIconSize = SystemTray.getSystemTray().getTrayIconSize();

            for (Image windowIconImage : windowIconImages) {

                if (Math.abs(trayIconSize.width - windowIconImage.getWidth(null)) < Math
                        .abs(trayIconImage.getWidth(null) - windowIconImage.getWidth(null))) {
                    trayIconImage = windowIconImage;
                }
            }

            final TrayIcon trayIcon = new TrayIcon(trayIconImage);
            trayIcon.setPopupMenu(getTrayIconPopup());

            trayIcon.addMouseListener(new MouseAdapter() {
                public void mouseClicked(final MouseEvent e) {

                    if (SwingUtilities.isLeftMouseButton(e)) {
                        if (e.getClickCount() >= 2) {
                            if (window.isVisible()) {
                                hide();
                            } else {
                                show();
                            }
                        }
                    }
                }
            });

            try {
                SystemTray.getSystemTray().add(trayIcon);
            } catch (AWTException e) {
                logger.error(
                        "unexpected exception trying to add the tray icon ( the desktop system tray is missing? )",
                        e);
            }
        }

        else {
            logger.error("the system tray is not supported on the current platform");
        }
    }

    //
    // hidden or not

    if (properties.isVisible()) {
        window.setVisible(true);
    }

    //
    // close the splash screen
    // if there is one

    try {

        SplashScreen splash = SplashScreen.getSplashScreen();

        if (splash != null) {
            splash.close();
        }
    }

    catch (UnsupportedOperationException e) {
        getLogger().info("splash screen not supported", e);
    }

    //
    // add shutdown hook for #destroy()

    Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            App.this.destroy();
        }
    });

    //
    // after init

    afterInit();
}

From source file:com.rinke.solutions.pinball.PinDmdEditor.java

/**
 * Open the window./*w  w  w.j ava  2  s.c  o  m*/
 * 
 * @param args
 */
public void open(String[] args) {

    CmdLineParser parser = new CmdLineParser(this);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.err.println(e.getMessage());
        // print the list of available options
        parser.printUsage(System.err);
        System.err.println();
        System.exit(1);
    }

    display = Display.getDefault();
    shell = new Shell();
    fileChooserUtil = new FileChooserUtil(shell);
    paletteHandler = new PaletteHandler(this, shell);
    aniAction = new AnimationActionHandler(this, shell);

    createContents(shell);

    createNewProject();

    paletteComboViewer.getCombo().select(0);
    paletteTool.setPalette(activePalette);

    animationHandler = new AnimationHandler(playingAnis, clock, dmd);

    animationHandler.setScale(scale);
    animationHandler.setEventHandler(this);
    animationHandler.setMask(project.mask);

    createBindings();

    SplashScreen splashScreen = SplashScreen.getSplashScreen();
    if (splashScreen != null) {
        splashScreen.close();
    }

    shell.open();
    shell.layout();
    shell.addListener(SWT.Close, e -> {
        e.doit = dirtyCheck();
    });

    GlobalExceptionHandler.getInstance().setDisplay(display);
    GlobalExceptionHandler.getInstance().setShell(shell);
    new Label(shell, SWT.NONE);
    new Label(shell, SWT.NONE);
    new Label(shell, SWT.NONE);
    new Label(shell, SWT.NONE);

    display.timerExec(animationHandler.getRefreshDelay(), cyclicRedraw);

    processCmdLine();

    int retry = 0;
    while (true) {
        try {
            log.info("entering event loop");
            while (!shell.isDisposed()) {
                if (!display.readAndDispatch()) {
                    display.sleep();
                }
            }
            System.exit(0);
        } catch (Exception e) {
            GlobalExceptionHandler.getInstance().showError(e);
            log.error("unexpected error: {}", e);
            if (retry++ > 10)
                System.exit(1);
        }
    }

}