O'Reilly logo

BlackBerry Java Application Development by Bill Foust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required