where is located JAR/FXML Manager option in javafx scene builder 1.1?

♀尐吖头ヾ 提交于 2019-12-11 08:36:00

问题


This is what i'm trying to find.

This is how my javafx scene builder 1.1 looks like. i have looked into all options but i couldn't figure out.


回答1:


I am very intrigued to know why you want to work with Scene Builder 1.1 which dates from 2013. I guess because you have to maintain some legacy JavaFX code with JDK 7?

I'd guess as well that you are aware that the current version for Scene Builder can be found here, and it supports JDK 8 and JDK 10.

Anyway, back to your question, the bad news is that Scene Builder 1.1 didn't have a menu for managing jar/fxml files. You can find more about this in this issue:

This functionality is now available in SB 2.0 Preview

The good news is that it had some kind of basic support for third party components. There are two ways you can enable a third party component:

  • If your fxml file includes some import not available in the classpath, SB will show a dialog to allow you adding the required jar to the classpath.

  • A more permanent solution (for every fxml, without this dialog) can be done by adding the jar directly to the app folder, and edit a cfg file to include it.

I had to search between my old files from that time to find some valid use case to test this. We can use a JFXtras jar from version 2.2 ('org.jfxtras:jfxtras-labs:2.2-r5') that can be downloaded from here.

You can create a fxml with one of its controls:

<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import jfxtras.labs.scene.control.*?>

<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
  <children>
    <BigDecimalField layoutX="160.0" layoutY="132.0" />
  </children>
</AnchorPane>

Now if you try to open this fxml with SB 1.1 you will get the dialog:

Here is where you can specify your jar(s):

You have to click Apply and then you will be able to open your fxml:

Now if you check the fxml file, you will notice the classpath will be included:

<?import jfxtras.labs.scene.control.*?>
<?scenebuilder-classpath-element C:/tmp/jfxtras-labs-2.2-r5.jar?>

This will work for this file only. And be aware that the scenebuilder-classpath-element tag was removed with SB 2.0.

If you want a more permanent solution, you can add the jar directly to the app folder (probably you will find it under C:\Program Files (x86)\Oracle\JavaFX Scene Builder 1.1\app).

And you have to edit the package.cfg file to add this:

app.classpath=scenebuilder.jar;jfxtras-labs-2.2-r5.jar

Save and launch SB 1.1. Now you will be able to open directly the fxml file or any other that requires that third party jar.



来源:https://stackoverflow.com/questions/51112367/where-is-located-jar-fxml-manager-option-in-javafx-scene-builder-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!