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