B4J Question Fontawesome in Library

BPak

Active Member
Licensed User
Longtime User
Can the Fontawesome be used in code inside a Library?
Want to use the up and down arrow in buttons.
If so how is it loaded?

FOUND: Right-Click in Code Editor and Select Icon Picker

However when using the Library it shows error message that Fontawesome.otf NOT found.

How to put Fontawesome.otf into the library so it can be found??
B4X:
Waiting for debugger to connect...
Program started.
Completed
Error occurred on line: 59 (Main)
java.io.FileNotFoundException: FontAwesome.otf
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:206)
    at anywheresoftware.b4j.objects.JFX.LoadFont(JFX.java:129)
    at anywheresoftware.b4j.objects.JFX.loadFontAwesome(JFX.java:58)
    at anywheresoftware.b4j.objects.JFX.CreateFontAwesome(JFX.java:72)
    at b4j.example.sql3db._createtable(sql3db.java:232)
    at b4j.example.main._createtablesbtn_click(main.java:149)
    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:497)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:613)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:231)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    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:497)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA$1.run(BA.java:215)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    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.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)
 

Attachments

  • SurveyLib.zip
    3.1 KB · Views: 183
  • TestSurvey.zip
    1.9 KB · Views: 191
Last edited:

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
workaround.
You can create a font and pass as parameter.

B4X:
Dim FontAwesome As Font = fx.CreateFontAwesome(20)
MyDb.Initialize(File.Combine(File.DirApp, "data"), "bpdb3", FontAwesome)


'On Lib

Public Sub Initialize(aPath As String, dbName As String, aFont as Font)

button1.font=aFont
 
Last edited:
Upvote 0
Top