custom controls in SceneBuilder

Tom Eugelink tbee at tbee.org
Fri Aug 31 05:14:00 PDT 2012


Hi Daniel,

I've tried your approach and it initially did not seem to be successful. So I created a stand alone FXML tests case to test, and that worked fine (screenshot attached). After some attempts it turns out that pressing "apply" after adding the entries to the classpath in SceneBuilder is important. Close does not apply them. (The word "Close" may indeed indicate that it does not apply the changes, but from an usability perspective I already pressed "Ok" when adding them, they are shown in the list; they're there, so I expected them to be already applied. FYI.) So it works. An annoyance of course is the fact that this must be done every time the file is opened. So a way to add jars & folders to the classpath of the SceneBuilder at boot time would be highly preferable (since the classpath extend functionality is already there, that should not be such an issue). And some kind of autoconfiguration in the jar's META-INF that an icon is added to the library pane.

Secondly, SceneBuilder does not seem to inspect the control itself; it has a number of properties, most importantly the "mode", which specifies if you can select just one date, a range, or many dates. But also "locale" and the initial value "calendar" should be present in the properties inspector.

While on the topic of the SceneBuilder, as you may or may not know that I've ported the infamous MigLayout to JavaFX many moons back. It also has FXML support (for the test case see http://code.google.com/p/miglayout/source/browse/javafx/src/test/java/org/tbee/javafx/scene/layout/test/MigPaneTest8.xml), so I figure that third party layout managers should be taken into account as well. Important in this case is the additional "MigPane.cc" attribute on each child, specifying the constraints.

Tom


On 2012-08-31 10:03, Daniel Fuchs wrote:
> Hi Tom,
>
> In SceneBuilder 1.0 it is not yet possible to add custom controls to
> SceneBuilder's library panel. It is however possible to load an
> FXML that contain custom controls. This is described in SceneBuilder's
> User's Guide - see section on custom type elements there:
>
> <http://docs.oracle.com/javafx/scenebuilder/1/user_guide/library-panel.htm>
>
> Note that for being able to load an FXML containing a custom element
> in SceneBuilder, that custom element must be "well behaved".
>
> 1. It must not require a special Builder Factory.
> 2. It must have a public empty constructor.
> 3. If it uses an FXMLLoader to load some nested FXML file, then that
>    FXMLLoader must be configured to use the ClassLoader from which
>    the custom component was loaded
>    (see <https://forums.oracle.com/forums/thread.jspa?forumID=1385&threadID=2433150>
>     for the gory details behind this last requirement)
>
> Don't hesitate to ping me directly for help/questions on this.
> I was planning to have a look at CalendarPicker sometime soon :-)
>
> Best regards,
>
> -- daniel
>
> On 8/30/12 11:59 PM, openjfx-dev-request at openjdk.java.net wrote:
>> Message: 5
>> Date: Thu, 30 Aug 2012 22:33:00 +0200
>> From: Tom Eugelink<tbee at tbee.org>
>> Subject: custom controls in SceneBuilder
>> To:openjfx-dev at openjdk.java.net
>> Message-ID:<503FCDFC.5060006 at tbee.org>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> After the forthcoming nights sleep I'm planning on integrating JFXtras' CalendarPicker in SceneBuilder. Anyone care to give me a URL with some starter tips? I have not even installed SceneBuilder (not a UI designer fanboy), so tomorrow will be interesting.
>>
>> Tom
>>
>



More information about the openjfx-dev mailing list