Getting Started with JavaFX script language (for swing programmers)

Source: Internet
Author: User
Tags netbeans

Original address: https://openjfx.dev.java.net/Getting_Started_With_JavaFX.html

The JavaFX script™ (hereinafter referred to as the JavaFX) language is a declarative, statically typed scripting language. It has first-level functions (first-class functions), declarative syntax (declarative syntax), list-comprehensions, and incremental evaluation based on dependencies (incremental dependency-based evaluation) and other characteristics. The JavaFX language enhances the role of the java2d swing component and makes it easy to create a graphical user interface or GUI.
When you create a JavaFX program, you have two options:
1. Use netbeans™ide 5.5.x or NetBeans IDE 6.0 preview (for more information).
2. Use CLI and your favorite source editor (for more information refer to JavaFX Wiki).
In this guide, you will learn how to quickly create a simple "Hello World" program using the JavaFX language and the NetBeans IDE (5.5.x or 6.0 preview). At the end of this article, you can learn more about the various GUI components available in the JavaFX script language by using the Learning more about the JavaFX script Language document.

Table of Contents (Contents)
Before you start
System Requirements
Software Requirements
Use the NetBeans IDE (5.5.x or 6.0 preview)
Learn more about the JavaFX script language

before beginning (before you begin)
You should have a basic understanding of the Java language, especially swing and java2d programming.
The NetBeans IDE 5.5.x or NetBeans 6.0 preview (MILESTONE9 or higher) must already be installed on your operating system. You should be familiar with the basics of the IDE. To learn the basics of the IDE, you can refer to the IDE Basics topics for its online documentation.
For more information about using the NetBeans IDE, please refer to the support and documentation on the NetBeans Web site.

Systems Requirements (System Requirements)
To run the NetBeans IDE, this article assumes that your operating system complies with the system requirements in NetBeans IDE 5.5 release notes or NetBeans IDE 6.0 Preview (M10) Release Notes (Systems Re Quirements) Part of the specified system requirements.

Software Requirements for this guide (Software Needed for the Tutorial)
Before you begin, you must install the following software on your machine:
1. NetBeans ide 5.5.x (download) or NetBeans IDE 6.0 preview (Milestone 9 or update) (download)
2. JavaFX script plug-ins (download instructions) for NetBeans IDE 5.5.x (download instructions) or NetBeans IDE 6.0 preview.

Using the NetBeans IDE (5.5.x or 6.0 preview) (using the NetBeans ide<5.5.x or 6.0 Preview release>)
The JavaFX script plug-in provides the ability to create JavaFX applications using the NetBeans IDE. Once you have installed the plug-in in the IDE, you can follow the steps below to create the first JavaFX program.
Note: The following picture is a screenshot when using NetBeans IDE 6.0 Preview (M9) release.
1. Create a project
2. Create and run the first JavaFX program

Create a project (Setting up a project)
First, create a NetBeans project that contains the first JavaFX program.
1, choose File > New Project from the IDE's main menu.
2. In the New Project Wizard, select JavaFX in the Categories panel and select JavaFX application in the Projects panel.

3, click Next.
4, enter the Javafxapp in the Project Name field.
5. In Project location, click Browse to specify where to save the project.

6, click Finish.
The Javafxapp project and the main.fx source file are created and displayed in the Projects window. The main.fx file is displayed in the source editor as shown in the following illustration:


Create and run the first JavaFX program (Creating and Running Your
Now, create your first JavaFX Hello World program, add the following fragment to the source file, and then follow the steps below to run the program.
1, in the source file editor, copy and paste the following code into the main.fx file: Import javafx.ui. * ;

Frame ... {
Title: "Hello World JavaFX"
width:200
Height:50
Content:label ... {
Text: "Hello World"
}
Visible:true
}

       2, after the Projects window, click the right mouse button on the Javafxapp node and select Run Project.

          Run the program, you should get a window like the following:

          now, you have completed the first JavaFX program using NetBeans 5.5.x or 6.0 Preview release.
         3, Continue reading "Learning more about the JavaFX Script Language" Create your first JavaFX script program.

Learn more about the JavaFX script language (Learning more about the JavaFX script Language)
   & nbsp;   Congratulations, you have now created your first JavaFX script through the steps in the previous sections. JavaFX provides an extended set of GUI components that are compatible with the Java Swing GUI components. For more information on JavaFX GUI components, refer to the Learning more about Java FX Script Language documentation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.