if( reg.getApplicationIndicator() != null ) {
reg.unregister();
}
ApplicationIndicator indicator;
if( args.length > 1 ) {
// Set icon and value
indicator = reg.register( icon, false, false );
indicator.set( icon, ( (Integer) args[ 1 ] ).intValue() );
} else {
// Set icon only
indicator = reg.register( icon, true, false );
indicator.setIcon( icon );
}
indicator.setVisible( true );
} catch( IllegalArgumentException e ) {
// According to the Java API, IllegalArgumentException will only
// occur when the icon is too big.
throw new IllegalArgumentException( "Icon is too big." );