B4J Tutorial B4J HowTo's

Status
Not open for further replies.
Dear All,

While learning and exploring B4J, captured B4J HowTos. The B4J HowTos are either from own experience or inspired by hints from the B4J forum (Thanks to All!).

Please note, due to other commitments, the B4J HowTos are not regularly updated, information might not cover solutions possible with the latest B4J version.

The content layout is generated by Look4How a Open Source Knowledge Management Application written in B4J

IMPORTANT (June 07, 2018)
The B4J HowTos are not online available anymore, but can be downloaded (v201806079). To install: unzip to a folder of choice and open index.htm.
Updates are made on the fly and not posted, so check this post from time-to-time.

Enjoy B4J (B4X) like I do.
 
Last edited:

fredo

Well-Known Member
Licensed User
Longtime User
Moin Rob,
great collection of information you created there. Thank you!

I'm new to B4J and just installed the environment.

I've tried a few howto's and it's flawless to work with and good to understand!

One Question:

- HowTo #15 throws an error "Property "stylesheets" does not exist or is read-only" (see log below)

- File "project.css" is in the files-folder

Could it be that I forgot to set something up?

Best regards,
fredo


B4X:
Program started.
B4JHowToSQLite v20140629
Error occurred on line: 65 (main).
com.sun.javafx.fxml.PropertyNotFoundException: Property "stylesheets" does not exist or is read-only.
    at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:423)
    at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:37)
    at javafx.fxml.FXMLLoader$Element.applyProperty(FXMLLoader.java:464)
    at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:287)
    at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:195)
    at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:586)
    at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2430)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2136)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:134)
    at b4j.example.main._appstart(main.java:171)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:35)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:215)
    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.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Thread.java:722)
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Fredo,

to go for sure have downloaded this howto and executed without any issues. This app has been developed using JDK 8 and JavaFX 2. Found in several threads, that when using JDK 7 this error occurs when an app has been developed using JDK 8. It is fixed when upgrading to JDK 8.
Pls verify which JDK version you use?

Thanks for your feedback - as always encouraging to continue.
 

B4JExplorer

Active Member
Licensed User
Longtime User
To run the access database example, ensure to copy the addtional libraries (packed in dbdrivermsaccess.zip part of the example zip) to your B4J additional library folder.

Thank You

Robert,

Sorry, but I don't see the dbdrivermsaccess.zip file in the XML-based version 1, or the Sqlite-based version 2.

When compiling version 1, it complains about this line:


gDlg.ShowMessage2(strMsg, strHdg, gDlg.MSGTYPE_INFORMATION)


, an unknown member error.

jRLStringPlus, jRLWinBatteryInfo, jrlmsgdialogs, and jrlini from your site, have all been installed in libraries.



When compiling the offline version 2 reader,

it complains about a missing jna-3.5.1.jar. A google search for 'b4j jna-3.5.1.jar', indicates that it's referenced on your BatteryInfo page http://www.rwblinn.de/142k1t43.htm, but when you link to that page, it isn't there.

The latest jna is available on github, but I don't think it has the wrapper and xml that's required by B4J.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

thanks for feedback. Pls find my reply:

The dbdrivermsaccess.zip file is included in B4J HOWTO Example project Nr. 12 (I have checked again)
12. Open and load MS Access Database records
http://www.rwblinn.de/b4j/b4jhowto/examples/b4jhowtomsaccess.zip
The B4J HOWTO Offline Readers do not require jna-3.5.1.jar. You can check this by reviewing the project attributes as defined in the b4j files.
For version 1, if you receive an error for the Message Dialog, you might have the wrong version of the jRLMsgDialogs Library. Ensure to use version 1.14, which is attached.

The Battery Info Library uses jna 4.1.0 as referenced in the readme.txt:
http://www.rwblinn.de/b4j/opensource/jrlwinbatteryinfo.zip
You do not need a wrapper for B4J - ensure to include the additional jna library in the project attributes.

Good Luck further in Exploring B4J...
 

Attachments

  • jrlmsgdialogs.zip
    4.7 KB · Views: 426

B4JExplorer

Active Member
Licensed User
Longtime User
Hi,

thanks for feedback. Pls find my reply:

The dbdrivermsaccess.zip file is included in B4J HOWTO Example project Nr. 12 (I have checked again)
12. Open and load MS Access Database records
http://www.rwblinn.de/b4j/b4jhowto/examples/b4jhowtomsaccess.zip
The B4J HOWTO Offline Readers do not require jna-3.5.1.jar. You can check this by reviewing the project attributes as defined in the b4j files.
For version 1, if you receive an error for the Message Dialog, you might have the wrong version of the jRLMsgDialogs Library. Ensure to use version 1.14, which is attached.

The Battery Info Library uses jna 4.1.0 as referenced in the readme.txt:
http://www.rwblinn.de/b4j/opensource/jrlwinbatteryinfo.zip
You do not need a wrapper for B4J - ensure to include the additional jna library in the project attributes.

Good Luck further in Exploring B4J...
rwblinn,

Sorry, I didn't see your reply until now. Thanks, will check it out today.
 

Mark Zraik

Member
Licensed User
Longtime User
Dear All,

While (keep on) learning and exploring B4J, I have started to capture B4J HOWTOs and published those with many example projects on my website.

The HOWTOs are either from own experience or based on hints from the B4J forum.

Updates are commenced regularly: Go here - Read Information > Whats New first.

Status 2015-03-04 = 481 B4J HOWTOs and 67 Open Source Example Projects.

B4J HOWTO Offline Readers (Open Source)
B4J: Version 1 for Windows (XML DB)
B4J: Version 2 for Windows (SQLite DB)
B4A: Version for Android 4+ (SQLite DB)


Enjoy B4J (and B4A, B4i) like I do.

Thank you so much for your hard work!
Mark
 

rwblinn

Well-Known Member
Licensed User
Longtime User
B4J HowTos Updated Jan 31, 2016: Read Whats New first. Total 888 HowTos, 107 Examples.

(just a side remark)
Got this month (unexpected) involved in various B4A app developments - it is great to see how code can be reused between B4A <> B4J, but also how fast apps (esp prototypes) can be developed using B4A = real RAD comes true here.
 

B4JExplorer

Active Member
Licensed User
Longtime User
Dear All,

While (keeping on) learning and exploring B4J, started to capture B4J HowTos and published those with many sample projects on my website.
The B4J HowTos are also available in responsive format at Select B4X > B4J HowTos.

The B4J HowTos are either from own experience or based on hints from the B4J forum (Thanks to All!).

Update Apr 30, 2016
  • Go here and read //Information > Whats New first.
  • 1016 HowTos and 127 Sample Projects
B4J HOWTO Offline Readers (Open Source)

Enjoy B4J (and B4A, B4i) like I do.
Hi Robert,

I tried compiling version 1, and received the

Error description: Unknown type: jrlmsgdialogs

error.

Then, when Compiling to Library the jRLDialogs class at http://www.rwblinn.de/142k1t40.htm,

the error

Error description: Access to the path 'C:\Software\Freeware\B4J\jRLDialogs\Objects\src\b4j\example' is denied

occurs.

After creating the b4j/example folder in the jRLDialogs class and copying it to the B4J Libraries folder, and closing & restarting the project, the original error that


Error description: Unknown type: jrlmsgdialogs

still occurs. jrlmsgdialogs is checked off, in the libraries form.
 

Attachments

  • HowTo_01_a.jpg
    HowTo_01_a.jpg
    199.9 KB · Views: 398
  • HowTo_01_b.jpg
    HowTo_01_b.jpg
    208.3 KB · Views: 385

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

based on your request, took following steps to verify:
1) Downloaded B4J: Version 1 for Windows (XML DB)..
2) The zip file contains the library jRLMsgDialogs v1.10. Copied jRLMsgDialogs.jar and jRLMsgDialogs.xml to the B4J Additional Libraries Folder.
3) Opened B4JHowTo.b4j in the B4J IDE (B4J v4.20 (1).
4) Verified the jRLMsgDialogs library in the B4J IDE list. Result version 1.1 listed and checked.
5) Compiled and run B4JHowTo v1 without issues.

Could you please check if the steps 1 - 5 will work in your environment.

Appreciated.
 

B4JExplorer

Active Member
Licensed User
Longtime User
The version may be the problem.

http://www.rwblinn.de/142k1t40.htm apparently contains version 1, rather than 1.1. The compilation works, only if gDlg as jRLDialogs, rather than jRLMsgDialogs.

I'll search around for the 1.1 version, and try again.


One interesting quirk, after compiling and testing this, is that my other non-ui apps won't compile now, unless an ../Objects/src/b4j folder is defined.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
B4J HowTos Updated Jun 21, 2016: Read News first. Total 1052 HowTos, 136 Examples.

Notes
Slowed down a bit in developing new B4J HowTos as been focussing on the new B4R development tool - for which I developed in the mean time 31 sample experiments (go here, select B4X > B4R > Arduino or ESP8266). Some of the B4R experiments show the integration between B4R and B4J - one of the great B4X power features.
 
Last edited:
Status
Not open for further replies.
Top