SVG Demo

  1. Create a new project, use wtk 2.5.2 as the emulator, make sure it is CLDC 1.1/MIDP 2.0, create Hello app
  2. Right click on project/Resources | Add Jar/Zip and browse to the file (attached)
  3. Switch to the editor | Flow, delete the Form
  4. ... and now, as quick as possible ;-). Drag'n'drop to the flow:
  • SVG Splash Screen
  • SVG Menu
  • SVG Wait Screen
  • 2 SVG Players
  • Alert
  1. now, add the images. Drag'n'drop following from Resources
  • splashscreen.svg to the Splash Screen
  • menu.svg to the SVG Menu
  • waitscreen.svg to the SVG Wait Screen
  • about.svg to the first SVG Player
  • halloween.svg to the second SVG Player
  • Double-click Alert to get to the Screen editor, double-click "<text not specified>" type in "Error downloading data" <Enter>.
  1. then some plumbing as well. Switch back to the Flow:
  • Connect Mobile device|Started to svgSplashScreen
  • Connect svgSplashScreen to the svgMenu
  • Connect svgMenu | menuItem_0 to svgWaitScreen
  • Connect svgMenu | menuItem_1 to svgPlayer1
  • Connect svgMenu | menuItem_2 to svgPlayer
  • Connect svgMenu | menuItem_3 to MobileDevice
  • Connect svgWaitScreen to the Alert, re-route output arrow back to the svgMenu
  • right-click on both svgPlayers | New/Add | Back command. Connect it back to the svgMenu
  • and some code - double click on the svgWaitScreen to get to the Screen editor| right-click on the task (right of the screen) | Go to source. Add Thread.sleep(3000) to simulate business logic. Flow
  1. Wow! and now, run the appplication, cool, isn't it?
  2. And now, let's add some more code. In the Flow editor, right-click on the svgMenu | Go to source. In the source code, write the following fragment to the 'post-init user code'
final SVGElement el = (SVGElement) getSvgImage1().getDocument().getElementById("dateTime");
TimerTask tt = new TimerTask() {
    public void run() {
        el.setTrait("#text", new Date().toString())
new Timer().schedule(tt, 0, 1000);

Do you see the time in the menu changing whend starting the application again?

Menu with the time changing

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