B4J Library jFXtrasGauges library

Following on from the taster thread that I posted earlier here is the first version of my jFXtrasGauges library that exposes the gauges from the JFXtras Labs library.

If you have not already found it from my jFXtrasControls thread I suggest you download the JFXtras demonstration to see what is contained in the JFXtras library. It is available from
http://jfxtras.org/resources/java/Ensemble.jar

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

The demo in the archive shows the gauges in JFXtras that I have exposed to B4J. All are usable and about half are complete. JFXtrasLCD, JFXtrasLinear and all the JFXtrasRadial gauges are based on a common rather complicated base class that will take me some more time to expose properly for the next version of this library. To get a flavour of the diversity possible with the Radials see this web page. I don't promise to be able to expose all those options!
http://harmoniccode.blogspot.co.uk/2012/06/jfxtras-series-radial-gauge.html

You should be able to add all these gauges to SceneBuilder following the directions given in the overall library comment in the xml. The clumsiness of the procedure is down to SceneBuilder and not B4J.

This library also includes a JFXColor object that provides a fairly simple but pretty complete access to the full colour capabilities of JavaFX.

There are three Forms in the demo and on each Form the button at the lower right will activate the gauges on that Form.

EDIT:- Version 1.1 now posted. See post #2 for details.
 

Attachments

  • jFXtrasGaugesDemo1.1.zip
    56.6 KB · Views: 1,186
Last edited:

giga

Well-Known Member
Licensed User
Longtime User
Look at the Sub AddMatrixContents in the demo.
problem solved

I discovered the version I had was 0.1 and there is no Sub AddMatrixContents. I downloaded 1.1 and will try it now. Thanks agraham for all your contributions to this great tool.
 

JSolum

New Member
Licensed User
Longtime User
I made a simple test application with a Linear Gauge and an LED. My goal was use a slider to control the gauge and a button to toggle the LED. I also used the same button to toggle the "User LED" that is a feature on the gauge. (Baby steps!) While I got it to work, a couple things puzzle me ...
When I generated the gauge and LED members, the following was placed in Process_Globals:
B4X:
Private mtrTest1 As Node
Private ledTest1 As Node

This generated an "unknown member" error when the program was run.
Using the example of the jFXtrasGauges demo I changed the above to

B4X:
Private mtrTest1 As JFXtrasLinear
Private ledTest1 As JFXtrasLED

This appears to work fine, but is it the proper way to do it?

Finally, when clicking the "Send" button, the following code runs:

B4X:
Sub btnSend_Action
If ledTest1.On Then
        ledTest1.On = False
    Else
        ledTest1.On = True
    End If
   
If mtrTest1.UserLedOn Then
        mtrTest1.UserLedOn = False
        Log(mtrTest1.UserLedOn)
    Else
        mtrTest1.UserLedOn = True
        Log(mtrTest1.UserLedOn)
    End If
   
End Sub

My Test1 LED toggles, but the meter's User LED does not. The log shows the (mtrTest1.UserLEDOn) is toggling True/False
but LED on the meter does not change.

Is there something I'm missing?

Thank you for this library and the great examples, they really help!
 

agraham

Expert
Licensed User
Longtime User
The Designer generates unknown (to it) Views as Node, the common subset of all visible items, so the compiler treats it as such so renaming it is the correct thing to do.

Unfortunately UserLed not changing appears to be a bug in jfxtras-labs-2.2-r5. As you can see the Gauge thinks the value has changed but deep down the change is not being propagated onto the display for some reason.
 

pepelillo

New Member
Hi all.

Completly newbe with B4J, I'n not a developer (my last experience was with VB 3.0 and VB 4.0 a long long time ago) but guess i can deal with B4A, I've been able to run some simple examples, but I want to test this wonderfull libraries. I follow the directions on http://www.b4x.com/b4j/help/jfxtrasgauges.html but no luck. I'm not be able to use this nodes in teh designer (I can import the library but the nodes/controls are not usable at all).

BTW the directions says that once used the dummy node (textarea) and changed with the desired gauge, the designer ask for the library on the next start, but this is not true in my case (javaFX designer 2.0). but aparently the node is inserted (I can view it in generate members)

This way once in B4J when I try to run the example (only want to show the gauge by now) the log throws and error "Radial is not a valid Type". AFAIK if you use the designer you don't need to use the activate method before showing the form in code.

Can anybody help?

So I understand that the library in this thread is necessary to use the Xtras-labs library


This is my simple code

#Region Project Attributes
#MainFormWidth: -1
#MainFormHeight: -1
#End Region

Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private btnPulsa As Button
Private lbl As Label
'Private txtArea As TextArea
Private radial1 As JFXtrasRadial
End Sub

Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("lyout1") 'Load the layout file.
MainForm.Show
End Sub


I allways get this error:

java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/javafx/scene/control/skin/SkinBase
 
Last edited:

pepelillo

New Member
Hi again.

Was my fault, Java8 was installed instead of Java7, so the error dissapeared. But the FXtras-lab library is no editable in the designer yet, so what's the point of using designer in this case? seems to be usefull only to locate the gauge in the interface, but any modification in properties seems to be discarded.
 

positrom2

Active Member
Licensed User
Longtime User
Trying to run JfxtrasGaugesdemo I get the error
Parsing code. 0.02
Compiling code. 0.16
Compiling debugger engine code. 1.51
Compiling generated Java code. Error
javac 1.7.0_02
src\b4j\example\main.java:6: error: package javafx.application does not exist
public class main extends javafx.application.Application{
^
I had copied the Lib files and also the jfxtras-labs-2.2-r5 file.
 

ta1dr

Member
Licensed User
Longtime User
I can not work it too... B4J compiled but I didnt see any UI, screen
 

rbghongade

Active Member
Licensed User
Longtime User
Dear agraham
Are you planning to update the Fxtra guages to support JDK 1.8.xx with your wonderful wrapper? Please do so as it shall immensely impact the versatility of B4J.
Regards,
 

GMan

Well-Known Member
Licensed User
Longtime User
Yeah, would be very nice - stuck also
 
Top