January 23, 2021
Hot Topics:

Using NetBeans to Develop a JavaFX Desktop Application

  • By Anghel Leonard
  • Send Email »
  • More Articles »

Add Created Nodes to Main.fx

The DeltaCars application is ready! However, nothing happens when you run it because the application nodes, DeltaTitleRect.fx, DeltaMenu.fx, DeltaCarLogo.fx, and DeltaAudioVideoPlayers.fx were not added to the Scene content. Therefore, the final version of Main.fx will look like this (notice how the MediaComponent is embedded in the scene):
package deltacars;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.paint.Color;
import com.sun.fxmediacomponent.*;
import javafx.scene.Group;
Stage {
    title: "Delta Cars"
    width: 712
    height: 442
    resizable: false   
    scene: Scene {
        stylesheets: [
        content: [ DeltaAudioVideoPlayers.mediaBox,DeltaMenu{},
                   DeltaTitleRect{},DeltaCarLogo{}, DeltaAudioVideoPlayers{}]

Running the DeltaCars Application

There is no trick to running the DeltaCars application: just select the Run Main Project option from the Run main menu. The project will compile and you should see an explosion of effects, transitions, fades, and so on. When everything is settled, the application will look like Figure 1.

As you have seen, NetBeans 6.5 for JavaFX 1.0 is an elegant method for developing JavaFX projects. In this article you learned how to develop such a project using the NetBeans support and various JavaFX classes.

Code Download

  • DeltaCars.zip
  • For Further Reading

  • The complete JavaFX 1.0 API Documentation (from Sun Developer Network)
  • About the Author

    Anghel Leonard is a senior Java developer with more than 12 years of experience in Java SE, Java EE, and the related frameworks. He has written and published dozens of articles about Java technologies and two books about XML and Java (one for beginners and one for experts).

    Page 5 of 5

    This article was originally published on July 1, 2009

    Enterprise Development Update

    Don't miss an article. Subscribe to our newsletter below.

    Thanks for your registration, follow us on our social networks to keep up-to-date