Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Using JavaFX Mobile to Combat Device UI Fragmentation : Page 4

JavaFX 1.1, a powerful tool for building rich UIs across a multitude of clients, provides mobile emulation for developing JavaFX Mobile applications. Get a beginner's guide to JavaFX Mobile development.


advertisement

JavaFX IDEs

While working with the SDK is easy, most developers will want the power and advantages of an integrated development environment (IDE). Today, at least two IDE options are available for developing JavaFX applications. NetBeans 6.5 completely supports JavaFX and JavaFX Mobile application development out of the box. Eclipse 3.4 also supports JavaFX development with the addition of a JavaFX plugin.

When the Java ME SDK 3.0 reaches final release, it will provide an important testing environment for JavaFX. However, it is not intended to be the development platform for JavaFX. NetBeans and Eclipse provide that today.

NetBeans 6.5

The NetBeans IDE allows you to create new JavaFX projects, classes, and stages (see Figure 13 and Figure 14).




Figure 13. The New Menu: The NetBeans IDE allows you to create JavaFX Script projects.
 
Figure 14. Creating a New JavaFX Class: The NetBeans IDE allows you to create JavaFX Script projects.

Source code editors support JavaFX-specific syntax with color-coded highlighting, code completion, code folding, documentation pop-ups, and syntax error detection. While editing JavaFX source files, developers can take advantage of a JavaFX palette to drag and drop common JavaFX elements into the source code (see Figure 15).

And since JavaFX coding is all about the design of the user interface, a nice little Preview button on the JavaFX editor allows for a quick visual peak at the results of the code in a popup window (see Figure 16).


Figure 15. NetBeans Supports JavaFX-specific Syntax: NetBeans provides code completion, JavaFX syntax color-coded highlighting, code folding, and Javadoc help.
 
Figure 16. The Enable Preview and Reset Preview Buttons: The Enable Preview and Reset Preview buttons allow developers to get a quick view of what the UI will look like when executed.

NetBeans 6.5 is packaged with the JavaFX SDK, so it is set up to use the SDK's mobile emulator. When a JavaFX application has been created using NetBeans, it can be quickly configured to be run or it can be emulated under a number of execution environments. Simply open the project properties for any JavaFX project (you can get to the project properties by right clicking on a JavaFX project in the Projects tab and selecting Properties from the menu) and click on the Run category in the Project Properties window (see Figure 17 and Figure 18).

A radio button choice allows you to quickly switch the Application Execution Model between standard desktop, Web Start, browser, or mobile emulator. The mobile emulator execution model allows you to pick from the two emulators provided through the JavaFX SDK: a default emulator and a touch screen emulator.


Figure 17. Runtime Environment for a JavaFX Application: You can set the runtime environment for a JavaFX application by the Project Properties window.
 
Figure 18. The Application Execution Model: The Application Execution Model determines whether the application will be run on the desktop, via Web Start, in a browser, or in a mobile emulator.

Remember, when developing applications to run across many platforms—especially mobile platforms, you need to stick to the JavaFX common profile. The JavaFX API documentation and language reference guide can help you figure out which classes are available under the common profile.

In NetBeans, when the Application Execution Model is set to "Run in a Mobile Emulator", classes that are not part of the common profile cause compiler errors and prevent the application from running in the mobile emulator. This handy indicator helps keep the applications you write truly portable.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap