B4J Question b4j and b4xbitmap

LordZenzo

Well-Known Member
Licensed User
I have this problem
in main
B4X:
Sub AppStart (Form1 As Form, Args () As String)
MainForm = Form1
MainForm.RootPane.LoadLayout ("first") 'Load the layout file.
MainForm.Show
DialogXUI2.LoadBmpOkButton (xui.LoadBitmapResize (File.DirAssets, "Done600.png" 100dip, 100dip, True))
End Sub
in CustomView (dialogXUI)
B4X:
public Sub LoadBmpOkButton (bmp As B4XBitmap)
OkButton.SetBitmap (bmp)
End Sub
when it assigns OkButton which is a b4xView (bread) it creates this error for me
B4X:
Waiting for debugger to connect...
Program started.
Errore nella linea: 114 (DialogXUI)
java.lang.ClassCastException: anywheresoftware.b4j.objects.PaneWrapper$ConcretePaneWrapper$NonResizePane cannot be cast to javafx.scene.image.ImageView
    at anywheresoftware.b4j.objects.ImageViewWrapper.SetImage(ImageViewWrapper.java:99)
    at anywheresoftware.b4a.objects.B4XViewWrapper.SetBitmap(B4XViewWrapper.java:543)
    at b4j.example.dialogxui._loadbmpokbutton(dialogxui.java:60)
    at b4j.example.main._appstart(main.java:93)
    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:498)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    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:498)
why this ?
java.lang.ClassCastException: anywheresoftware.b4j.objects.PaneWrapper $ ConcretePaneWrapper $ NonResizePane cannot be cast to javafx.scene.image.ImageView
why if I only use b4xbitmap, does it tell me this?
 

Erel

Administrator
Staff member
Licensed User
Always pay attention to the B4XView methods documentation. It tells you which views support each method. SetBitmap is only supported by ImageView in B4J and B4i. Add an ImageView to the panel.
 

LordZenzo

Well-Known Member
Licensed User
Always pay attention to the B4XView methods documentation. It tells you which views support each method. SetBitmap is only supported by ImageView in B4J and B4i. Add an ImageView to the panel.
yes, after several tests I understood this
that I can't use B4xView directly but ImageView-> b4xview to use the setbitmap method
 
Top