JavaFXApplet

My first JavaFX Applet

This tutorial shows how you configure a draggable JavaFX Applet. A draggable applet can be dragged out of the web browser, and it keeps running even after the browser is closed. When you quit the Applet, you can reopen it via a shortcut from the Windows explorer like any other desktop application.

Pre-requisities

  1. Firefox 3.0 (or IE 7)
  2. JRE 6u11
  3. NetBeans with JavaFX plugins

Make sure Firefox or IE7 is your default browser and it uses the JRE 6u10+!

For the Store as Shortcut feature, go to Control Panel of your Java Control Panel -> Advanced tab -> Shortcut Creations and set the radio button to prompt user (or something similar).

Create a simple JavaFX application

  1. Start NetBeans 6.5 with JavaFX
  2. Go to File | New Project | JavaFX | JavaFX Script Application, Next, Finish
  3. A new JavaFX project is created and Main.fx is opened
  4. Feel free to modify the source (optional)
  5. Drag and drop the item Colors | Orange from the palette to the editor
 Application
  1. Open project properties by right-clicking on the project in the Projects window.
  2. Go to the Run category and check Run in Browser
  3. You can consider creating a run configuration if you're testing your application for multiple targets:
 Run configuration
  1. In the Application category, check:
    1. Draggable Applet (optional)
    2. Self Signed Jar (optional)
    3. Pack200 Compression (smaller download size but makes the build process longer)
  2. Confirm by clicking OK
  3. Run the project using Run menu or using the Run icon on toolbar.
  4. Click 'Run Applet' from the context menu
 Application properties
  1. The Applet will start in the browser.
  2. Press and hold Alt key and drag the applet out of the browser window.
  3. Close the browser and it will ask you to store the applet as a shortcut.
  4. Note how the Applet keeps running even after the browser is closed.
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