JavaFXApplet

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 6u10
  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.1 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. Drag and drop the item Applications | Application from the palette to the editor
    JavaFXApplet
  5. Drag and drop the item Text from the Palette to the content of the application in the editor
    JavaFXApplet
  6. Open project properties by right-clicking on the project in the Projects window.
  7. Go to the Applet category and check:
    1. Run Applet in browser
    2. use JavaScript
    3. from jnlp file
    4. draggable
  8. Confirm by clicking OK
    JavaFXApplet
  9. Right click on the Main.fx in the Project window.
  10. Click 'Run Applet' from the context menu
    JavaFXApplet
  11. The Applet will start in the browser.
  12. Press and hold Alt key and drag the applet out of the browser window.
  13. Close the browser and it will ask you to store the applet as a shortcut.
  14. Note how the Applet keeps running even after the browser is closed.

 

Kaynak wiki.netbeans.org/JavaFXApplet


Yorumunuzu Ekleyin


Yükleniyor...
Yükleniyor...