B4J Question b4j and b4xbitmap

Discussion in 'B4J Questions' started by LordZenzo, Jul 24, 2019.

  1. LordZenzo

    LordZenzo Well-Known Member Licensed User

    I have this problem
    in main
    Code:
    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" 100dip100dipTrue))
    End Sub
    in CustomView (dialogXUI)
    Code:
    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
    Code:
    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?
     
  2. Erel

    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.
     
  3. LordZenzo

    LordZenzo Well-Known Member Licensed User

    yes, after several tests I understood this
    that I can't use B4xView directly but ImageView-> b4xview to use the setbitmap method
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice