B4J Question B4XFloatTextField SetTextAlignment with error

so27

Active Member
Licensed User
Longtime User
Hello everybody,

I use a B4XFloatTextField in my program. With SetTextAlignment I want to center the font.
B4X:
    txtGewicht.TextField.SetTextAlignment("CENTER", "CENTER")

An error occurs when starting the program:
main._appstart (java line: 111)
java.lang.RuntimeException: Type does not match (class javafx.scene.control.TextField)
at anywheresoftware.b4a.objects.B4XViewWrapper.typeDoesNotMatch(B4XViewWrapper.java:573)
at anywheresoftware.b4a.objects.B4XViewWrapper.SetTextAlignment(B4XViewWrapper.java:448)
at b4j.example.main._appstart(main.java:111)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)

I'm using OpenJDK 11 + OpenJFX 11.

screenshot_12_02092020.png


What am I doing wrong?
 

Jorge M A

Well-Known Member
Licensed User
Longtime User
@Erel,
It seems that in some update of XUI Views some kind of bug was introduced...
In the original XUI Views Example, (from here) the same error occurs when setting this property.
B4X:
    B4XFloatTextField1.Text = "Abcde"
    B4XFloatTextField1.TextField.SetTextAlignment("CENTER", "CENTER")
Error occurred on line: 446 (B4XFloatTextField)
java.lang.RuntimeException: Type does not match (class javafx.scene.control.TextField)
at anywheresoftware.b4a.objects.B4XViewWrapper.typeDoesNotMatch(B4XViewWrapper.java:573)
at anywheresoftware.b4a.objects.B4XViewWrapper.SetTextAlignment(B4XViewWrapper.java:448)
 
Upvote 0

so27

Active Member
Licensed User
Longtime User
It works fine with B4A and B4i. Only with B4J it obviously doesn't work.

B4X:
    txtGewicht.TextField.SetTextAlignment("CENTER", "CENTER")
    txtGroesse.TextField.SetTextAlignment("CENTER", "CENTER")

photo_2020-09-04_07-27-04.jpg

screenshot_01_04092020.png
 
Upvote 0
Top