B4J Library jFXtrasControls library

If you are using the jMsgboxes library, and you should be, you will already have release 5 of FXtra Labs, jfxtras-labs-2.2-r5.jar. This library exposes some controls also located in jfxtras.

There's a Breadcrumb Bar and Items. A NumberUpDown, Date and Time Pickers and a List Spinner. Version 1.1 enhanced the ListSpinner and added DateTextField, TimeTextField and XYControl

If you don't already have it release 5 of jfxtras can be downloaded from
http://central.maven.org/maven2/org/jfxtras/jfxtras-labs/2.2-r5/jfxtras-labs-2.2-r5.jar

There is a demonstration for JFXtras called Ensemble that is modelled after a similar demonstration for Java FX. It used to be linked from the JFXtras home page but the link has gone. I found it at
http://jfxtras.org/resources/java/Ensemble.jar
and it is worth downloading and trying it. It includes sample Java code which is useful as the Javadoc for jfxtras-labs-2.2-r5.jar is devoid of comments.

The similar Ensemble for JavaFX itself can be found on Oracles website for Java in javafx_samples-2_2_45-windows.zip at bottom of this page
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.
This is also well worth looking at.

EDIT :- Version 1.2 now posted with SceneBuilder integration. See post #8 for details.

EDIT :- Version 1.3 now posted with MDI Window control. See post #14 for details.

EDIT :- Version 1.4 now posted with additional events. See post #18 for details.
 

Attachments

  • jFXtrasControlsDemo1.4.zip
    45.8 KB · Views: 2,013
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Looks great:

SS-2013-12-01_12.23.24.png
 

Theera

Well-Known Member
Licensed User
Longtime User
Hi Agraham,
It 's better for me,if you release source code the library for edit Thai Date Picker. I like your library,but I couldn't use it.
 

Frederikson

Member
Licensed User
Longtime User
Hi,

the demo works and these controls look really, really good!. Thanks for this lib!
However, is it possible to have these additional controls in Scene Builder, or is it necessary to edit the *.fxml file by hand?


Edit:
Sorry for the post. I took a look at the b4j-File and saw, that the additional GUI-Controls are added there. Never the less I'd still like to know, if it's possible to extend Scene Builder with these controls? Thanks!
 
Last edited:

agraham

Expert
Licensed User
Longtime User
It will be possible with the next release of both JFXtrasControls and JFXtrasGauges, although SceneBuilder doesn't make it entirely straightforward. Here is part of the help for the next JFXtrasGauges.


*To integrate these gauges with SceneBuilder you need to manually add this line to your fxml layout file
*after the existing set of imports at the start of the file.
*
*<?import jfxtras.labs.scene.control.gauge.*?>
*
*Then in SceneBuilder add a simple control, TextArea is a good one, and name with a Node Id for B4J.
*Position and size the controls and do the same for any other gauges you want then close SceneBuilder.
*Manually edit the fxml again by finding the TextArea lines
*
*<TextArea id="Battery1" layoutX="49.0" layoutY="173.0" prefHeight="106.0" prefWidth="105.0" wrapText="true" />
* and change 'TextArea' to the required type and remove 'wrapText'
*<Battery id="Battery1" layoutX="49.0" layoutY="173.0" prefHeight="106.0" prefWidth="105.0" />
*
*When you next start SceneBuilder it will want a path to the unknown controls. Check "Set up classpath",
*click the "+ Jar..." button and locate jfxtras-labs-2.2-r5.jar. Clicl "Apply" and "Close". You will have to do this
*each time you restart SceneBuilder, although the path will be already selected, but for some reason SceneBuilder
*will not automatically use it.
*
*The gauges should now be visible in SceneBuilder and also visible to "Generate Members" in B4J.
 

mrossen

Active Member
Licensed User
Longtime User
Hi agraham,

Thank you for this lovely library, and the new features. This was just what I needed.

I have just found a strange thing. Maybe a bug or something I do wrong.

If I press the button more than 0.5 - 1 sec then the Led1 picture turns om black until I move the pointer out of the button.

Does this make sense? or do you need my project ?

B4X:
Sub btnTest_MousePressed (EventData As MouseEvent)
 
    Led1.Color = FXColor.Color("Green")
    Led1.On = True
 
End Sub

Sub btnTest_MouseReleased (EventData As MouseEvent)
 
    Led1.Color = FXColor.Color("Red")
    Led1.On = False
 
End Sub

EDIT: Sorry I posted in the wrong Library thread. I was surpossed to be in the jFXtrasGauge Library thread.

@Erel: Can you move it?
 
Last edited:

mrossen

Active Member
Licensed User
Longtime User
Update,

I dont know why but I have not the problem now?

I return if the problem comes back,

Mogens
 

positrom2

Active Member
Licensed User
Longtime User
Hi,
I have added that line
<?import jfxtras.labs.scene.control.gauge.*?>
to the layout1.fxml file. Opening the SceneBuilder I get the error message:
com.oracle.javafx.authoring.persist.FXMLDocument$FxmlParseException: Failed to load FXML file
at com.oracle.javafx.authoring.persist.FXMLDocument.makeParseException(FXMLDocument.java:400)
at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:311)
at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:239)
at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:224)
at com.oracle.javafx.authoring.Project.forFxml(Project.java:835)
at com.oracle.javafx.authoring.Project.forFxml(Project.java:807)
at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:197)
at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:185)
at com.oracle.javafx.authoring.DesignerTool.commonInit(DesignerTool.java:513)
at com.oracle.javafx.authoring.DesignerTool.init(DesignerTool.java:457)
at com.oracle.javafx.authoring.SceneBuilderLauncher$RunningWithJMXInstance.launch(SceneBuilderLauncher.java:71)
at com.oracle.javafx.authoring.Main.start(Main.java:72)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
at java.lang.Thread.run(Thread.java:724)
Caused by: javafx.fxml.LoadException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,6]
Message: Verarbeitungsanweisungsziel, das "[xX][mM][lL]" entspricht, ist nicht zulässig.
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2180)
at com.oracle.javafx.authoring.persist.FXMLDocument$2.call(FXMLDocument.java:301)
at com.oracle.javafx.authoring.util.Utils.withFXMLDefaultClassLoader(Utils.java:2216)
at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:298)
... 21 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,6]
Message: Verarbeitungsanweisungsziel, das "[xX][mM][lL]" entspricht, ist nicht zulässig.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:88)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2150)
... 24 more
What to do?
 

agraham

Expert
Licensed User
Longtime User
Version 1.3 now posted has an added control JFXtrasWindow which provide an MDI style child window. It should be usable in any Pane. Close and Minimize icons, that raise events, may be added to the Window as well as two custom icons that also raise evwents when clicked. At the moment you can't style these icons as I don't know how to do it :( Maybe in the future!
 

agraham

Expert
Licensed User
Longtime User
Version 1.4 now posted has added useful events to some controls.

Clear and PromptText properties and NumberChanged event added to JFXtrasNumberUpDown
DateChanged event added to JFXtrasDateTextField
TimeChanged event added to JFXtrasTimeTextField
XChanged and YChanged events added to XYControl
ItemChanged event added to JFXtrasListSpinner
 

mrossen

Active Member
Licensed User
Longtime User
Hi,

I have used your child form, but I have at problem,

The first time I open there no problem, the next time it will not show.

B4X:
Sub mnuRemote_Action

    Window.Title = "RF Remote Test"
    Window.ContentPane.LoadLayout("remote")
    MainForm.RootPane.AddNode(Window, 239, 122, 504, 500)
  
End Sub

I do this, can you see any problem,

Mogens
 
Top