NBDemoMobilityApplicationPorting

(Difference between revisions)
(Created page with '__NOTOC__ ==Application porting with Mobility Pack (5 Minutes)== ===Description=== This demo showcases the application porting features of NetBeans Mobility Pack. ===Product Ve…')
 
Line 13: Line 13:
===Demo Prep===
===Demo Prep===
* Install [http://www.netbeans.info/downloads/dev.php NB 6.0 beta1] or higher with Mobility Pack.
* Install [http://www.netbeans.info/downloads/dev.php NB 6.0 beta1] or higher with Mobility Pack.
-
* Unzip the [[BallGame_NBDemoMobilityApplicationPorting.zip| demo project]] to your disk.  
+
* Unzip the [[BallGame.zip| demo project]] to your disk.  
===Gotchas===
===Gotchas===
Line 21: Line 21:
* Open the BallGame project.
* Open the BallGame project.
* Run the game and shoot a couple of balls:
* Run the game and shoot a couple of balls:
-
[[Image:balls_small_NBDemoMobilityApplicationPorting.png | Image:balls_small_NBDemoMobilityApplicationPorting.png]]
+
[[Image:balls_small.png | Image:balls_small.png]]
* Mention that the size of the game is too small for this phone.
* Mention that the size of the game is too small for this phone.
* Explain that Mobility Pack lets you manage configurations and we'll create a new configuration.
* Explain that Mobility Pack lets you manage configurations and we'll create a new configuration.
Line 42: Line 42:
* Run the demo with the SunPhone configuration.
* Run the demo with the SunPhone configuration.
* Explain that the game is bigger now:
* Explain that the game is bigger now:
-
[[Image:balls_NBDemoMobilityApplicationPorting.png | Image:balls_NBDemoMobilityApplicationPorting.png]]
+
[[Image:balls.png | Image:balls.png]]
* Switch to Motorola and run the game.
* Switch to Motorola and run the game.
* It will be smaller again.
* It will be smaller again.
Line 50: Line 50:
===Demo Cleanup ===
===Demo Cleanup ===
Delete the demo project.
Delete the demo project.
-
{{attachments|
 
-
* [[Media:BallGame_NBDemoMobilityApplicationPorting.zip]]}}
 

Current revision as of 20:49, 6 November 2009

Application porting with Mobility Pack (5 Minutes)

Description

This demo showcases the application porting features of NetBeans Mobility Pack.

Product Versions Supported

6.0 Beta1+

Points to Hit

  • Mobility pack lets you create configurations and provides a pre-preprocessor which help to port your application to different devices.

Demo Prep

Gotchas

We're at Beta, anything can go wrong.

Demo

  • Open the BallGame project.
  • Run the game and shoot a couple of balls:

File:Balls small.png

  • Mention that the size of the game is too small for this phone.
  • Explain that Mobility Pack lets you manage configurations and we'll create a new configuration.
  • Go to project properties and click on Manage Configurations.
  • Add new configuratio and call it SunPhone.
  • Close the dialog.
  • Open class com.cotopia.games.BallShotImageCreator
  • Go to line 32 and mention that the ball size is set here and can be changed.
  • Create a pre-processor block using right click | Preprocessor blocks | Create If / Else block
  • Use code completion to select SunPhone and change the code like this:
//#if SunPhone
        this.ballWidth = 24;        
//#else
        this.ballWidth = 16;        
//#endif
  • Switch to Motorola configuration and explain that the code for SunPhone gets commented out.
  • Switch back to SunPhone and explain that the else block gets commented out now.
  • Run the demo with the SunPhone configuration.
  • Explain that the game is bigger now:

File:Balls.png

  • Switch to Motorola and run the game.
  • It will be smaller again.
  • Switch to files window.
  • Browse the dist directory and show different jars for different phones.

Demo Cleanup

Delete the demo project.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo