B4J Library ControlsFX Library

Status
Not open for further replies.

Erel

Administrator
Staff member
Licensed User
ControlsFX is a large open source library that extends JavaFX: http://fxexperience.com/controlsfx/features/
It requires Java 8.

jControlsFX is a wrapper for several controls and features from this library.

The following controls are supported:
BreadCrumbBar, CheckComboBox, ColorPicker, HyperlinkLabel, InfoOverlay, ListSelectionView, SegmentedButton, Separator and StatusBar.
You can see them in the screenshot (Mac version) and attached project.
You can download the compiled version of this example: www.b4x.com/b4j/files/ControlsFXExample.jar

upload_2015-2-15_17-32-19.png


It also includes a class with useful features named ControlsUtils.
ControlsUtils allows you to:
- Set the nodes background color or image.
- Add a decoration to a node (like the exclamation mark near the text field above).
- Show notifications.
- Set the size of nodes even if you do not know the node type.

PropertySheet:



http://www.b4x.com/android/forum/threads/propertysheet.50863/#post-318066

Note that the library is included in B4J installation.
 

Attachments

Last edited:

Peter Simpson

Expert
Licensed User
Hmm, clicking on either of the two Show notification buttons causes a big bang. I'll look at it more closely when I get the chance later. But everything else works and It's looking grrrrrrrrrrrreat.
B4X:
Sub btnNotificationInForm_Action
    cutils.ShowNotification3("Controls FX Notification", "Shown in form", cutils.ICON_INFORMATION, _
        MainForm, "BOTTOM_CENTER", 5000)
End Sub

Sub btnNotification_Action
    cutils.ShowNotification("Controls FX Notification", "Shown in screen", cutils.ICON_WARNING)
End Sub
Causes
B4X:
Program started.
Range: 20 - 100
Range: 20 - 80
main._btnnotificationinform_action (java line: 136)
java.lang.NoClassDefFoundError: com/sun/javafx/scene/traversal/ParentTraversalEngine
    at org.controlsfx.control.ButtonBar.<init>(ButtonBar.java:412)
    at org.controlsfx.control.ButtonBar.<init>(ButtonBar.java:355)
    at org.controlsfx.control.action.ActionUtils.createButtonBar(ActionUtils.java:429)
    at impl.org.controlsfx.skin.NotificationBar.updatePane(NotificationBar.java:164)
    at impl.org.controlsfx.skin.NotificationBar.<init>(NotificationBar.java:160)
    at org.controlsfx.control.Notifications$NotificationPopupHandler$1.<init>(Notifications.java:332)
    at org.controlsfx.control.Notifications$NotificationPopupHandler.show(Notifications.java:332)
    at org.controlsfx.control.Notifications$NotificationPopupHandler.show(Notifications.java:317)
    at org.controlsfx.control.Notifications.show(Notifications.java:263)
    at org.controlsfx.control.Notifications.showInformation(Notifications.java:238)
    at anywheresoftware.b4j.objects.ControlsUtils.ShowNotification3(ControlsUtils.java:131)
    at b4j.example.main._btnnotificationinform_action(main.java:136)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA$2.run(BA.java:165)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
    at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.sun.javafx.scene.traversal.ParentTraversalEngine
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 27 more
[/Code}
 

Erel

Administrator
Staff member
Licensed User
Thank you.
This issue: java.lang.ClassNotFoundException: com.sun.javafx.scene.traversal.ParentTraversalEngine is related to the Java version.

You need Java 1.8.0_20+ (install the latest version and it will work).
 

jmon

Well-Known Member
Licensed User
Thanks a million for this great library!!

Any possibility to have the notifications show a custom image?
 

jmon

Well-Known Member
Licensed User
I will add it in the next update.
Thanks. If it's not too much to ask, would it be possible to add the dark theme to the notifications too?:
B4X:
notificationPane.getStyleClass().add(NotificationPane.STYLE_CLASS_DARK);
Thanks again for this library.
 

jmon

Well-Known Member
Licensed User
I modified your source code, and I got what I needed. Very simple in fact, thanks for publishing the source code, I now know how to make java classes!:
B4X:
public void ShowNotification4(String Title, String Text, Node Graphic, String Position, int DurationMs) {
    Notifications n = Notifications.create().title(Title).text(Text);
    n.position(getPosition(Position));
    n.hideAfter(Duration.millis(DurationMs));
    n.graphic(Graphic);
    n.darkStyle();
    n.show();
}
in B4j:
B4X:
    Dim iv As ImageView
iv.Initialize("")
iv.SetImage(fx.LoadImageSample(File.DirAssets, "User1.png", 64, 64))
iv.Width = 64
iv.Height = 64
n.ShowNotification4("Hello", "Black style", iv, "BOTTOM_RIGHT", 3000)
and this is the result:
Capture.PNG


Thanks!
 

rwblinn

Well-Known Member
Licensed User
Great Library and many thanks for the source.

Good learning and easy to modify using Eclipse - in short steps:
Create a new project jControlsFX, add the additional jars jCore, jFX and controlsfx-8 to the build path, import the java files from the controlsfx folder, make modifactions, create javadoc, export as jar. Thats it.

Looking forward for more to come...
 

aidymp

Active Member
Licensed User
I modified your source code, and I got what I needed. Very simple in fact, thanks for publishing the source code, I now know how to make java classes!:
B4X:
public void ShowNotification4(String Title, String Text, Node Graphic, String Position, int DurationMs) {
    Notifications n = Notifications.create().title(Title).text(Text);
    n.position(getPosition(Position));
    n.hideAfter(Duration.millis(DurationMs));
    n.graphic(Graphic);
    n.darkStyle();
    n.show();
}
in B4j:
B4X:
    Dim iv As ImageView
iv.Initialize("")
iv.SetImage(fx.LoadImageSample(File.DirAssets, "User1.png", 64, 64))
iv.Width = 64
iv.Height = 64
n.ShowNotification4("Hello", "Black style", iv, "BOTTOM_RIGHT", 3000)
and this is the result:
View attachment 32539

Thanks!
Is there any possibility this will be built into the library I really want that option!

Thanks

Aidy
 

aidymp

Active Member
Licensed User
Great Library and many thanks for the source.

Good learning and easy to modify using Eclipse - in short steps:
Create a new project jControlsFX, add the additional jars jCore, jFX and controlsfx-8 to the build path, import the java files from the controlsfx folder, make modifactions, create javadoc, export as jar. Thats it.

Looking forward for more to come...
Just trying this method, but apparently I have 100 errors! i presume i have done something wrong, but i dont know java and i have just downloaded eclipse! any pointers please?
 

rwblinn

Well-Known Member
Licensed User
Hi aidymp,

you need to change the package name from (default package) to anywheresoftware.b4j.objects.
How: By selecting (default package), press F2 and then enter the package name anywheresoftware.b4j.objects followed by OK.

Give a Try again,
Rob
 

aidymp

Active Member
Licensed User
I modified your source code, and I got what I needed. Very simple in fact, thanks for publishing the source code, I now know how to make java classes!:
B4X:
public void ShowNotification4(String Title, String Text, Node Graphic, String Position, int DurationMs) {
    Notifications n = Notifications.create().title(Title).text(Text);
    n.position(getPosition(Position));
    n.hideAfter(Duration.millis(DurationMs));
    n.graphic(Graphic);
    n.darkStyle();
    n.show();
}
in B4j:
B4X:
    Dim iv As ImageView
iv.Initialize("")
iv.SetImage(fx.LoadImageSample(File.DirAssets, "User1.png", 64, 64))
iv.Width = 64
iv.Height = 64
n.ShowNotification4("Hello", "Black style", iv, "BOTTOM_RIGHT", 3000)
and this is the result:
View attachment 32539

Thanks!
Hi, any chance of a copy of the library that lets you change the colour and image I really like the idea of custom images

Thanks

Aidy
 

jmon

Well-Known Member
Licensed User
Hi, any chance of a copy of the library that lets you change the colour and image I really like the idea of custom images

Thanks

Aidy
Here it is, I called it Notifications4 or something like that.
You can modify the source code, then compile it with the simple library compiler that Erel created. You will find it on the forum.
 

Attachments

koaunglay

Member
Licensed User
ControlsFX is a large open source library that extends JavaFX: http://fxexperience.com/controlsfx/features/
It requires Java 8.

jControlsFX is a wrapper for several controls and features from this library.

The following controls are supported:
BreadCrumbBar, CheckComboBox, ColorPicker, HyperlinkLabel, InfoOverlay, ListSelectionView, SegmentedButton, Separator and StatusBar.
You can see them in the screenshot (Mac version) and attached project.
You can download the compiled version of this example: www.b4x.com/b4j/files/ControlsFXExample.jar

View attachment 32225

It also includes a class with useful features named ControlsUtils.
ControlsUtils allows you to:
- Set the nodes background color or image.
- Add a decoration to a node (like the exclamation mark near the text field above).
- Show notifications.
- Set the size of nodes even if you do not know the node type.

PropertySheet:



http://www.b4x.com/android/forum/threads/propertysheet.50863/#post-318066

Installation instructions:

1. Download the library: http://fxexperience.com/downloads/controlsfx-8.20.8.zip
2. Rename controlsfx-8.20.8.jar to controlsfx-8.jar and copy it to the additional libs folder.
3. Make sure that the IDE is configured to use Java 8 (Tools - Configure Paths).
4. Download the attached library and add it to your project.

Please pay attention to the installation instructions. They include a "non-standard" step.
The library Java source code is included in the library zip.
B4X:
B4J version: 3.00
Parsing code.    (0.01s)
Compiling code.    (0.05s)
Compiling generated Java code.    Error
javac 1.7.0_03
src\b4j\example\main.java:7: error: package javafx.application does not exist
public class main extends javafx.application.Application{
                                            ^
1 error
 

jmon

Well-Known Member
Licensed User
B4X:
B4J version: 3.00
Parsing code.    (0.01s)
Compiling code.    (0.05s)
Compiling generated Java code.    Error
javac 1.7.0_03
src\b4j\example\main.java:7: error: package javafx.application does not exist
public class main extends javafx.application.Application{
                                            ^
1 error
Read the second line of the first post. It require Java 8 minimum.
 
Status
Not open for further replies.
Top