B4J Library ControlsFX Library

Discussion in 'B4J Libraries & Classes' started by Erel, Feb 15, 2015.

  1. Erel

    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:

    [​IMG]

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

    Note that the library is included in B4J installation.
     

    Attached Files:

    Last edited: Dec 6, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    Windows screenshot (you can see the info overlay expanded here as well as the checked combo box):

    [​IMG]
     
  3. Peter Simpson

    Peter Simpson Expert Licensed User

    This is great great great stuff @Erel. Thank you very very very much :cool:
     
  4. Peter Simpson

    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.
    Code:
    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
    Code:
    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
    }
     
  5. Douglas Farias

    Douglas Farias Expert Licensed User

  6. Erel

    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).
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Douglas Farias likes this.
  8. jmon

    jmon Well-Known Member Licensed User

    Thanks a million for this great library!!

    Any possibility to have the notifications show a custom image?
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    I will add it in the next update.
     
    jmon likes this.
  10. jmon

    jmon Well-Known Member Licensed User

    Thanks. If it's not too much to ask, would it be possible to add the dark theme to the notifications too?:
    Code:
    notificationPane.getStyleClass().add(NotificationPane.STYLE_CLASS_DARK);
    Thanks again for this library.
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    NotificationPane is a different control.
     
    jmon likes this.
  12. jmon

    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!:
    Code:
    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:
    Code:
    Dim iv As ImageView
    iv.Initialize(
    "")
    iv.SetImage(fx.LoadImageSample(
    File.DirAssets, "User1.png"6464))
    iv.Width = 
    64
    iv.Height = 
    64
    n.ShowNotification4(
    "Hello""Black style", iv, "BOTTOM_RIGHT"3000)
    and this is the result:
    Capture.PNG

    Thanks!
     
  13. rwblinn

    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...
     
  14. aidymp

    aidymp Active Member Licensed User

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

    Thanks

    Aidy
     
  15. aidymp

    aidymp Active Member Licensed User

    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? [​IMG]
     
  16. rwblinn

    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
     
  17. aidymp

    aidymp Active 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
     
  18. jmon

    jmon Well-Known Member Licensed User

    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.
     

    Attached Files:

    aidymp likes this.
  19. koaunglay

    koaunglay Member Licensed User

    Code:
    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
     
  20. jmon

    jmon Well-Known Member Licensed User

    Read the second line of the first post. It require Java 8 minimum.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice