Time for action - adding a focus icon to Hansel

  1. Replace the code in the main method with the following code.
    public static void main(String[] args)
    {
    if ( args != null && args.length > 0 && args[0].equals("Icon") )
    {
    UiApplication theApp = new HanselApp(true);
    theApp.enterEventDispatcher();
    }
    else
    {
    UiApplication theApp = new HanselApp(false);
    theApp.enterEventDispatcher();
    }
    }
    
  2. Then, replace the constructor of the HanselApp with the next code snippet.
    public HanselApp(boolean setIcon) { if (setIcon) { invokeLater(new Runnable() { public void run() { ApplicationManager myApp = ApplicationManager. getApplicationManager(); boolean inStartup = true; while (inStartup) { if (myApp.inStartup()) { try { Thread.sleep(1000); } catch (InterruptedException ...

Get BlackBerry Java Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.