JavaFXPluginTutorial

Revision as of 14:15, 25 November 2009 by Sunflower (Talk | contribs)

Contents


Install NetBeans 6.8 Beta and JavaFX plugin

  1. Go to the NetBeans Download page
  2. Download and Install one of the following options
    1. NetBeans 6.8 with the JavaFX Bundle
    2. NetBeans 6.8 Full installation
    3. NetBeans 6.8 (any version) and add the JavaFX Plugins from the Tools->Plugins->Available Plugins dialog.

Create a simple JavaFX Application

  1. Launch the IDE
  2. Invoke File| New Project... from the main menu bar.
  3. Under Categories, select JavaFX.
  4. Under Projects, select JavaFX Script Application.
  5. Click Next.
  6. In the Project Name field, type HelloWorld.
  7. Click Finish.
  • The HelloWorld JavaFX project is created
  • The Main.fx file opens

File:javafx_project_JavaFXPluginTutorial.png

8. Copy the code to the editor

import javafx.stage.*;

import javafx.scene.*;
import javafx.scene.text.*;
import javafx.scene.paint.*;
import javafx.scene.effect.*;


Stage {
title: "JavaFX Hello World"
width: 250
height: 80
scene: Scene {
content: Text {
x: 10 y: 30
font: Font { size: 24 }
fill: Color.BLUE
effect: DropShadow{ offsetX: 3 offsetY: 3}
content: "Hello World!"
}
}
}

REPLACE WITH:

  1. Change your application Title
    1. Change _title: "Application title"_ to _title: "JavaFX Hello World"_
  2. Add Content to your page
    1. Change the font size to 24
    2. Add a Fill to your Text content by dragging a color oject into the text block
      1. Add a "fill:" member to the text block
      2. drag the color you want from the palette and drop it in the code immediately following the "fill:"
    3. Add a Drop Shadow effect to your Text content by dragging a Drop Shadow effect into the Text Block.
      1. Add ae "effect:" member to the text block
      2. drag the Drop Shaddow effect from the palette and drop it in the code immediately following the "effect:"
    4. Change the content from "Application Text" to "Hello World!"

9. Press F6 to run the JavaFX project

  • The JavaFX Hello World application appears

File:javafx_helloworld_JavaFXPluginTutorial.png

JavaFX Script language Tutorial

Change this heading to "To learn more about JavaFX"

Use the JavaFX Tutorial Overview to create JavaFX Script applications which include

  • 2D Graphics
  • UI Controls
  • Effects
  • Animation
  • Video and Audio

Learn more about the JavaFX Script language

JavaFX Plugin Features

  • Editor
  • Code Highlighting
  • Code Completion
  • Source Navigation
  • Code Folding
  • Javadoc
  • Error Detection
  • Refactoring
  • To enable the refactoring add the -J-Djavafx.refactoring=true flag to the netbeans.conf file
  • Palette
  • Deployment
  • Desktop
  • Applet
  • WebStart
  • Mobile Emulator
  • Debuger
  • Profiler
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