Friday, May 18, 2012

JavaFX FXML Application

FXML is a scriptable, XML-based markup language for constructing Java object graphs. It provides a convenient alternative to constructing such graphs in procedural code, and is ideally suited to defining the user interface of a JavaFX application, since the hierarchical structure of an XML document closely parallels the structure of the JavaFX scene graph.

- To creates a JavaFX FXML-enabled application in a standard IDE project: Click File -> New Project... in NetBeans IDE.

- Select Categories of JavaFX, and Projects of JavaFX FXML Application, then click Next.

- Enter name and location of the project, then click Finish.

Three Files under Source Packages will be created:
  • Sample.fxml: The FXML source file to define the UI.
  • The controller file to handle user input of mouse and keyboard.
  • The main Java code.

Now, try to run the auto-generated JavaFX FXML Application.

No comments:

Post a Comment