Javafx scene builder intellij idea

When you open an FXML file in the editor, there are two tabs underneath the editing area:

Text. This tab is for developing the markup.

Scene Builder. This tab is for editing the file in JavaFX Scene Builder. (You should be using the Scene Builder version 2.x.)

If you haven’t specified the path to Scene Builder yet, there is the text Please configure JavaFX Scene Builder path.

Click the path link and select the Scene Builder executable file in the dialog that opens.

After a while, the FXML file will open in Scence Builder.

If you are using Scene Builder version 1.x, the Scene Builder tab is empty and you should use the following procedure (this works for version 2.x too):

Select the FXML file of interest in the Project tool window, or open the file in the editor.

From the context menu, select Open In SceneBuilder . (If you are in the editor, this applies to the Text tab.)

Данный урок более справочный чем учебный, но мало кто знает о том, что в Intellij IDEA можно использовать JavaFX Builder. В этом уроке мы рассмотрим как это сделать.

Шаг 1

Создаем новый проект:

Обратите внимание что мы выбрали JavaFX Application.

Шаг 2

Теперь заходим на этот сайт и скачиваем Scene Builder 1.1, и потом устанавливаем.

Далее заходи в наш проект и по файлу sample.fxml нажимаем правой кнопкой мыши.

После этого выберите установленный Scene Builder:

Читайте также:  Java io ioexception неверный дескриптор

После этого откроется Scene Builder.

Шаг 3

Изначально наш sample.fxml имел следующее содержимое:

После того как мы откроем её в Scene Builder и добавим несколько элементов:

В итоге файл sample.fxml будет иметь следующую структуру:

Шаг 4

Теперь давайте запустим наш проект и посмотрим, что же получилось:

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 >Create New Project , as shown in Figure 4-1.

Figure 4-1 Select Create New Project in the Welcome Window


Description of "Figure 4-1 Select Create New Project in the Welcome Window"

In the New Project dialog box, select JavaFX Application , specify the project information, as shown in Figure 4-2, and click Finish .

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

Figure 4-2 Specify the Project Information for the New JavaFX Application Project


Description of "Figure 4-2 Specify the Project Information for the New JavaFX Application Project"

Читайте также:  Гк самотлор отзывы сотрудников

Expand the nodes for the project, as shown in Figure 4-3.

Figure 4-3 Expand the Nodes in the Project Window


Description of "Figure 4-3 Expand the Nodes in the Project 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.

Figure 4-4 Open JavaFX Scene Builder to sample.fxml File


Description of "Figure 4-4 Open JavaFX Scene Builder to sample.fxml File"

In the Scene Builder Configuration dialog window, specify the path to your Scene Builder installation the first time you try to open Scene Builder from within IntelliJ >OK , as shown in Figure 4-5.

Figure 4-5 Select Path to the Scene Builder Installation Folder


Description of "Figure 4-5 Select Path to the Scene Builder Installation Folder"

Use the JavaFX Scene Builder User Guide document to learn more about the available Scene Builder features and the Getting Started with JavaFX Scene Builder tutorial to create a simple issue tracking application.

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.

Читайте также:  Rollback rx home rus

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:

Ensure that you have downloaded JavaFX Scene Builder Samples bundle file from the Additional Resources section of the Java SE Download page at http://www.oracle.com/technetwork/java/javase/downloads/index.html and extracted its contents.

From the IntelliJ >File and choose Import Project .

Navigate to the location where you extracted the JavaFX Scene Builder samples and expand the Login sample folder. Select the src folder and click OK .

In the Import Project wizard, keep the ”Create project from existing sources” option selected and click Next .

Type Login in the Project Name field, if it is not already filled in, and click Next .

Leave the rest of the default choices and values specified in the Import Project wizard and continue to click Next until you see the Finish button. Click Finish .

Choose to open the new project in the current window or open a new window.
The new Login project is opened in the Project tab.

In the Project tab, right-click the node for the Login project’s Main >Run Main.main() as shown in Figure 4-6.

Figure 4-6 Run the Main Class File for Login Sample Application


Description of "Figure 4-6 Run the Main Class File for Login Sample Application"

The window for the Login sample application appears on top of the IDEA window, similar to what is shown in Figure 3-10.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock detector