Share My Creation FXML loader in B4J

Using the power of B4J , I managed to load and show a javafx FXML file as a user interface.
However, I did neither add script actions to interact with the controls, nor a controller class , which may be the
next step. Here is a short video clip to illustrate this. I apologize if the quality of the video is poor because of internet issues.
1695151483705.png
 

jkhazraji

Active Member
Licensed User
Longtime User
A controller class is now added so that the user can interact with the input form elements and it responds with accordingly
1695160783029.png

 

jkhazraji

Active Member
Licensed User
Longtime User
The loading and show of the fxml file is done using only JavaObject and a bit of inline Java
I added a simple context menu with a handler to close the stage . Also the form style was made
'undecorated' and it is moved by pressing and dragging the mouse on any point of the form.
I tried to load the fxml file in the usual way and with my Javaobject and inline Java code so that it is loaded and
shown twice but the undecorated one is with a context menu and can be dragged by the mouse.
The screen capture program did not show the context menu (I donno why!!??)
1695312299919.png

 

Mashiane

Expert
Licensed User
Longtime User
Hi

If you dont mind me asking, whilst I understand that you have to do this, what are the added benefits of using this approach outside the normal way of doing things?
Is it easier to do things with it or it takes more time? What are the pros and cons.

In a larger scheme of things, I think, if one finds FXML templates and wants to use them in b4x? perhaps?
 

Magma

Expert
Licensed User
Longtime User
I think... he is doing that because of JavaFX Scene Builder (theoretically has much good stuff but i don't know in reality how possible is to use that without writting a lot of code).... and as I remember in the old days... b4a also uses that for layouts... some here already tried that or was asking about that..

 

jkhazraji

Active Member
Licensed User
Longtime User
Hi

If you dont mind me asking, whilst I understand that you have to do this, what are the added benefits of using this approach outside the normal way of doing things?
Is it easier to do things with it or it takes more time? What are the pros and cons.

In a larger scheme of things, I think, if one finds FXML templates and wants to use them in b4x? perhaps?
Thank you for commenting on my post. As you know b4j can load FXML file in the code and show it like its usual .bjl layout but I could not load the FXML file in the internal designer (I had an error). I wanted to expose its events and methods as in bjl file the way we do. Then I discovered that events and methods of FXML file are exposed by the control classes which should be provided in the same path. Consequently I ended up using this code to play with FXML file and its controls. I can not tell how much benefit it adds. Although I noticed, with my limited experience, that FXML file provides controls which are not native to b4j that have powerful abilities through the use of control classes and do not need wrapping of their original code into libraries to be used in b4j. As you mentioned, there are a lot of FXML templates out there on the internet, uncountable number I guess, which can be brought to b4x environment and made use of.
Edit: FXML only requires the change of a parameter to load in b4j IDE, but still all the events and methods are to be controlled from the control class written in Java. My code controls them from within b4j.
 
Last edited:

jkhazraji

Active Member
Licensed User
Longtime User
I think... he is doing that because of JavaFX Scene Builder (theoretically has much good stuff but i don't know in reality how possible is to use that without writting a lot of code).... and as I remember in the old days... b4a also uses that for layouts... some here already tried that or was asking about that..

Hi,
Much of the the code can be imported to b4j (as is) and made use of!
 

jkhazraji

Active Member
Licensed User
Longtime User
Accordion control brought to b4j

sorry for video quality, internet issues always there
 
Top