gillius / jfxutils

JavaFX Utilities - Zoom and Pan Charts and Pane Scaling
Apache License 2.0
68 stars 22 forks source link

JavaFX Scene Builder 1.1 --- jfxutils integration #2

Closed bob-anderson-ok closed 10 years ago

bob-anderson-ok commented 10 years ago

This may be a real newbie question, but...

I want to use Scene Builder to create the .fxml files.

The Charting.fxml sample file contains the line ...

<?import org.gillius.jfxutils.chart.StableTicksAxis?> 

and the lines ...

<xAxis>
      <StableTicksAxis animated="true" side="BOTTOM" />
</xAxis>
<yAxis>
       <StableTicksAxis animated="true" side="LEFT" />
</yAxis>

As a result, Scene Builder will not open the Charting.fxml file.

What can I do about this?

bob-anderson-ok commented 10 years ago

Solved.

Yup, it was a newbie question. But it's probably worth describing my travails as it can happen to others.

I was using NetBeans 8.0 and Scene Builder 2.0

When I double clicked on Charting.fxml in NetBeans 8.0, Scene Builder 2.0 simply threw up an error dialog that had no info.

I switched to Scene Builder 1.1. Now double clicking Charting.fxml causes Scene Builder 1.1 to produce an error dialog box that describes the error ... cannot find the StableTicksAxis class --- and also provides the opportunity to provide a classpath to it. That worked --- sort of. It could find the class, but now it had an invalid major.minor version number. That's because NetBeans 8.0 uses JDK 8 as the default compiler. Scene Builder 1.1 is one JDK release back.

So I told NetBeans 8.0 to use JDK 7. Now it compiles and runs (very nice zoom and pan by the way!!). And now Scene Builder 1.1 is happy with the versioning of the class file and open nicely to show the chart.

And of course I discovered the

<?scenebuilder-classpath-element ../../../../../build/classes?>

that got added to the fxml file. But that didn't make the error message from Scene Builder 1.1 go away when opening the fxml file. I still have to specify a classpath, but it is now nicely filled in for me, so it's not much effort to get the file open. But I do wonder why I still have to go through that now that the relevant classpath is encoded directly in the fxml file. I tried replacing the relative path with an absolute path, but that doesn't help either.

bob-anderson-ok commented 10 years ago

Solved: the issue where even with the classpath encoded in the fxml file, Scene Builder 1.1 still pops up a dialog box asking for a classpath.

There is a checkbox on that dialog that says basically, "don't bother me with this again". I checked that, and now double clicking the Charting.fxml file in NetBean 8.0 (but using JDK 7) opens Scene Builder 1.1 without incident.

gillius commented 10 years ago

Thanks for posting this and following up on the solution. The need for classpath is a little confusing and disappointing fact about Scene Builder. The scenebuilder-classpath-element is a new one for me, that must be a new feature of version 8. I imagine for those using Maven as build process it would point into the "target" folder.