B4J Question ScrollPane1 B4j

SMOOTSARA

Active Member
Licensed User
Longtime User
Hello friends ?
I need to build a ScrollPane1 and load a latout in it.(ScrollPane1)


I make it in Designer.
And I created another layout in the designer for add to ScrollPane1 .(layout_data)

But when I define the layer
B4X:
Sub Class_Globals
Private ScrollPane1 As B4XView
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    
    Root = Root1
    Root.LoadLayout("MainPage")
    B4XPages.GetManager.SetTitle(Me,"test name)
    
    

    Log(ScrollPane1.IsInitialized)   
    ScrollPane1.LoadLayout("layout_data")

End Sub




I get the following error


B4X:
Waiting for debugger to connect...
Program started.
true
Error occurred on line: 152 (B4XMainPage)
java.lang.reflect.InvocationTargetException
    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.keywords.Common.CallSubDebug2(Common.java:460)
    at b4j.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:826)
    at b4j.example.b4xpagesmanager._showpage(b4xpagesmanager.java:320)
    at b4j.example.b4xpagesmanager._addpage(b4xpagesmanager.java:170)
    at b4j.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:184)
    at b4j.example.b4xpagesmanager._initialize(b4xpagesmanager.java:117)
    at b4j.example.main._appstart(main.java:84)
    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.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 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.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    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)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:134)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:81)
    ... 35 more
Caused by: java.lang.reflect.InvocationTargetException
    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.debug.Debug.CallSub4(Debug.java:115)
    ... 36 more
Caused by: java.lang.ClassCastException: class javafx.scene.control.ScrollPane cannot be cast to class javafx.scene.layout.Pane (javafx.scene.control.ScrollPane is in module javafx.controls of loader 'app'; javafx.scene.layout.Pane is in module javafx.graphics of loader 'app')
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:101)
    at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:503)
    at b4j.example.b4xmainpage._b4xpage_created(b4xmainpage.java:140)
    ... 41 more

 

klaus

Expert
Licensed User
Longtime User
ScrollPane1.ScrollViewInnerPanel.LoadLayout(...)
Strange.
The ScrollPane1.LoadLayout method does exist.
The ScrollPane1.ScrollViewInnerPanel does not exist !?
The ScrollPane1.InnerNode does exist but it has no LoadLayout method.

Then:
ScrollPane1.LoadLayout (LayoutFile As String, Width As Double, Height As Double)
needs three parameters!
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Klaus,

Smootsara has defined the Scrollpane1 as a B4xView which has the inner pane exposed as ScrollViewInnerPanel.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…