B4J Library jObservable


Licensed User
Observables are primitive types (boolean, byte, double, float, integer, long, short), strings, objects or collections (map, list, record) that trigger events when they are modified. They can also automatically update the views with which they are bound.

Example 1: You have associated an ObservableString with all the OK buttons of your application. By changing the value of this Observable (e.g. ofConfirmButton.Value = "OK"), you change at the same time the label of all OK buttons, regardless of the module in which they are declared.

Example 2: In your application, you want to perform a task each time a list is modified by your code (e.g. saving the content to a file), regardless of the module in which that list is modified. By using an ObservableList, it becomes easy to perform the task according to the triggered event (Added, Cleared, Removed, Sorted, Updated).

Example 3: You have linked an ObservableField to a field in a database table. By changing the ID of this Observable, you get the value of the field corresponding to this ID and you trigger an Updated event. By changing the Observable value, you update the field in the database and trigger an Updated event.

Please note that this library is not based on the Observable class of Java. Its code is entirely written from scratch.

It exists a version for Android here.



Licensed User
Tested "ListAndMapEvents":

Unexpected event (missing RaiseSynchronousEvents): olist_cleared

Updated: it works in release mode (only, I suppose).
Last edited:


Well-Known Member
Licensed User
Thank you Informatix. That's a very useful library!

No, the project crashes.
It crashes in non-UI mode, but the same examples in UI mode work in DEBUG.

I systematically forget to add @RaiseSynchronousEvents in my Java libraries.
Weird that it works in UI but not in Non-UI. But adding the code above should fix the problem I guess
Last edited: