Scene builder intellij idea linux

4 Using Scene Builder with IntelliJ IDEA

This chapter gives information on how to download and use the JavaFX 2 plug-in that provides the JavaFX integration with the IntelliJ IDEA 13 Community Edition.

The JavaFX 2 plug-in enables you to create a new JavaFX Application project, start Scene Builder from within the IDE, and run the Scene Builder Login sample application. It is assumed that you have already installed Scene Builder before continuing with the rest of this chapter. Go to the JavaFX Scene Builder Installation Guide for installation information.

Downloading and Installing IntelliJ IDEA

Use the information from http://www.jetbrains.com/idea/download/ to download and install the latest IntelliJ IDEA 13 version that includes the JavaFX plug-in.

Creating a New JavaFX Application

The JavaFX plug-in for IntelliJ IDEA 13 enables you to create a new JavaFX application template.

    From the IntelliJ IDEA welcome window, click the Create New Project , as shown in Figure 4-1.

The node for a new JavaFX application template is added to the Project tab in the main window.

Starting Scene Builder from IntelliJ IDE

Included in a newly created JavaFX Application template is the sample.fxml, which you can open and edit using Scene Builder.

    In the Projects tab, right-click the sample.fxml file and select Open In Scene Builder , as shown in Figure 4-4.

Where to Go From Here

Now that you are familiar with the integration between the Scene Builder tool and IntelliJ IDEA, look at JavaFX Scene Builder User Guide to learn more about the available Scene Builder features. Also, use the Getting Started with JavaFX Scene Builder to create a simple issue tracking application.

You can also try running the sample applications provided with the Scene Builder release. These samples are Netbeans projects, so use the information in the following section to learn how to use one of the samples using the IntelliJ IDEA.

Running Scene Builder Samples from IntelliJ IDEA

Use the following steps to run the Login sample that is included in the JavaFX Scene Builder samples bundle:

Источник

Release: JavaFX Scene Builder 1.1

The picture of the author Jerome Cambon

Jerome is a member of the JavaFX Scene Builder development team.

Cindy Castillo

The picture of the author Cindy Castillo

Cindy is a technical writer in the JavaFX group. She has written tutorials, online help, and technical articles for Java and JavaFX technologies.

Читайте также:  Playing with linux commands

We Welcome Your Comments

If you have questions about JavaFX, please go to the forum.

Using JavaFX Scene Builder with Java IDEs

3 Using Scene Builder with IntelliJ IDEA

This chapter gives information on how to download and use the JavaFX 2 plugin that provides the JavaFX integration with the IntelliJ IDEA 12.1.

The JavaFX 2 plugin enables you to create a new JavaFX Application project, start Scene Builder from within the IDE, and run the Scene Builder HelloWorld sample application. It is assumed that you have already installed Scene Builder before continuing with the rest of this chapter. Go to the JavaFX Scene Builder Installation Guide for installation information.

Downloading and Installing IntelliJ IDEA

Use the information from http://www.jetbrains.com/idea/download/ to download and install the latest IntelliJ IDEA 12.1 version that includes the JavaFX 2 plugin.

Creating a New JavaFX Application

The JavaFX 2 plugin for IntelliJ IDEA 12.1 enables you to create a new JavaFX application template.

    From the IntelliJ IDEA welcome window, click the Create New Project , as shown in Figure 3-1.

The node for a new JavaFX application template is added to the Project tab in the main window.

Starting Scene Builder from IntelliJ IDE

Included in a newly created JavaFX Application template is the sample.fxml, which you can open and edit using Scene Builder.

    In the Projects tab, right-click the sample.fxml file and select Open In Scene Builder , as shown in Figure 3-4.

Where to Go From Here

Now that you are familiar with the integration between the Scene Builder tool and IntelliJ IDEA, look at JavaFX Scene Builder User Guide to learn more about the available Scene Builder features. Also, use the Getting Started with JavaFX Scene Builder to create a simple issue tracking application.

You can also try running the sample applications provided with the Scene Builder release. These samples are Netbeans projects, so use the information in the following section to learn how to use one of the samples using the IntelliJ IDEA.

Running Scene Builder Samples from IntelliJ IDEA

Use the following steps to run the HelloWorld sample that is included in the JavaFX Scene Builder samples bundle:

Источник

How to setup a JavaFX 8 project in IntelliJ

JavaFX 8 is the newest Java framework for creating rich multi-platform desktop applications that it ships out of the box with the standard edition JRE. The framework has been developed by learning from the mistakes of the previous such libraries (AWT, Swing, and the first JavaFX). The only downside is that it requires Java 8 and above to run.

This post will be about how to setup an IntelliJ IDEA project for a complex application with JavaFX 8 the way it should be done.

Prerequisites

To start the project we should download and install the following programs:

  1. IntelliJ Community or Ultimate edition – download
  2. Java Development Toolkit 8 – download
  3. JavaFX Scene Builder 2.0 – download

Create the project

  1. Start up IntelliJ and start a new project using File > New > Project:
    Project
  2. Name your project as you’d like and it should look similar to this:
    CreatedProject

This is all good for a small app. We get a sample organization of our files but for a large project this structure will not do.

Читайте также:  Astra linux zabbix proxy

Improve the project

To scale up we need to create well defined packages for our separate class-types. The controllers, models and views. By design JavaFX is MVC (Model-View-Controller) oriented and we should leverage that fact by exploiting the built-in mechanisms for organizing the code.

So before we start with coding we should:

  1. Add our default package name for the sake of the example that would be “com.example.javafxapp”
  2. Create 3 more sub-packages “controller”, “model” and “view”.
  3. Leave the Main file on the top-level
  4. Move the Controller class to the “controller” package
  5. Rename and move the FXML view file to the “view” package

ImprovedProject

In the end the result should look like this:

Setup Scene Builder with IntelliJ

One of the best ways to develop the UI for the JavaFX application is to use the WYSIWYG (What You See Is What You Get) tool named Scene Builder. IntelliJ lets you run it from the context menu of your view files to save time. The first time you need to tell IntelliJ where to look for the installed Scene Builder executable:

OpenInSB

SetupSB

Where to go from here

Now that you have the advanced project setup in place you can start using Scene Builder to create your initial user interface and add programmatic behaviour to it via the controller classes. Don’t forget to externalize your application logic to the model classes so that they are unit testable without depending on UI code.

A great article on how to start with Scene Builder (albeit using Eclipse instead of IntelliJ) is posted here, so be sure to check it out as well.

Источник

Release: JavaFX Scene Builder 1.1

The picture of the author Jerome Cambon

Jerome is a member of the JavaFX Scene Builder development team.

Cindy Castillo

The picture of the author Cindy Castillo

Cindy is a technical writer in the JavaFX group. She has written tutorials, online help, and technical articles for Java and JavaFX technologies.

We Welcome Your Comments

If you have questions about JavaFX, please go to the forum.

Using JavaFX Scene Builder with Java IDEs

1 Using Scene Builder with NetBeans IDE

This chapter describes how to download and install NetBeans IDE, use it to create a new JavaFX FXML project, start Scene Builder from within the IDE, and run Scene Builder sample applications.

The integration of JavaFX Scene Builder with NetBeans IDE provides optimal development workflow. It is assumed that you have already installed Scene Builder before continuing with the rest of this chapter. Go to the JavaFX Scene Builder Installation Guide for installation information.

Downloading and Installing NetBeans IDE

Go to http://netbeans.org/downloads for the latest NetBeans IDE 7.4 download and installation information.

Creating a New JavaFX FXML Project

In NetBeans IDE, you use the New wizard to create a new JavaFX FXML Application, which is a JavaFX project that is based on an FXML layout. After the project is created, you can edit the FXML file using Scene Builder.

  1. From the NetBeans IDE Main menu, select File , and then choose New Project .
  2. In the New Project dialog box, choose the JavaFX category and J avaFX FXML Application project, as shown in Figure 1-1. Click Next .

Starting Scene Builder from NetBeans IDE

As shown in Figure 1-3, you can either choose Open to edit the FXML file with the Scene Builder tool or choose Edit to edit the FXML file with the Netbeans FXML editor.

Figure 1-3 Open FXML File from NetBeans IDE

When you right-click the node for the FXML file and choose Open , then NetBeans IDE automatically locates the latest installed Scene Builder on your system and the Scene Builder window appears on top of the Netbeans window, as shown in Figure 1-4.

If you want to use a different installation of Scene Builder or if NetBeans cannot locate the installed Scene Builder, use the following steps to set the location of the Scene Builder installation you would like to use with NetBeans IDE.

  1. From the Main menu, select Tools and choose Options .
    On the Mac OS platform, select NetBeans and choose Preferences from the Main menu.
  2. In the Options window, click Java and then the JavaFX tab.
  3. Specify the location of the Scene Builder installation folder and then click OK .

Figure 1-4 Open FXML File in Scene Builder (Click image to enlarge.)

To open the FXML file in the NetBeans FXML editor, from the File menu, right-click the file’s node and choose Edit . The FXML source file contents are shown in the IDE’s source editor window, as shown in Figure 1-5.

Figure 1-5 Open FXML File in NetBeans FXML Editor

Synchronizing With the Controller Source Code

The NetBeans IDE’s Make Controller feature allows you to synchronize the modifications you make in the FXML file that is currently opened in Scene Builder and the controller source code opened in NetBeans IDE. To illustrate this feature, do the following:

  1. In Scene Builder, drag a Button control from the Library panel to the Control panel.
  2. In the Code panel, assign a new value for the new button’s fx:id field and a new method name for the onAction method.
  3. Select File in the main menu and then Save .
  4. In NetBeans IDE 7.4 or later, right click the project node for the FXML file that you just edited and select Edit from the contextual menu.
  5. From the main menu, select Source and then Make Controller .
    The @FXML private variable and the new onAction method for the button you just added in Scene Builder are created in the controller source file. Use the Make Controller command if you delete an element in the Control panel or update an fx:id value or a method name in Scene Builder.

Where to Go From Here

Now that you are familiar with the integration between the Scene Builder tool and NetBeans IDE, look at JavaFX Scene Builder User Guide to learn more about the available Scene Builder features. Use the steps described in Getting Started with JavaFX Scene Builder to create a simple issue tracking application.

You can also try the sample applications provided with the Scene Builder release. These samples are Netbeans projects, which means they can be compiled and ran directly after being opened in the NetBeans IDE. You can download the Scene Builder samples from http://www.oracle.com/technetwork/java/javafx/downloads/index.html . Right-click the project’s node in the IDE’s Project window and choose Run , as shown in Figure 1-6.

Figure 1-6 Run Scene Builder Sample Application

Источник

Оцените статью
Adblock
detector