Hi All.
I am trying the effect in B4J ( https://www.b4x.com/android/forum/threads/b4x-xui-simple-halo-animation.80267/#content )
B4J 8.30
But the moment I go to compile I have the following error:
Why ?
Thank you
I am trying the effect in B4J ( https://www.b4x.com/android/forum/threads/b4x-xui-simple-halo-animation.80267/#content )
B4J 8.30
B4X:
Dim xui As XUI
CreateHaloEffect(MainForm, 90, 90, xui.Color_Green)
Sub CreateHaloEffect (Parent As B4XView, x As Int, y As Int, clr As Int)
Dim cvs As B4XCanvas
Dim p As B4XView = xui.CreatePanel("")
Dim radius As Int = 150dip
p.SetLayoutAnimated(0, 0, 0, radius * 2, radius * 2)
cvs.Initialize(p)
cvs.DrawCircle(cvs.TargetRect.CenterX, cvs.TargetRect.CenterY, cvs.TargetRect.Width / 2, clr, True, 0)
Dim bmp As B4XBitmap = cvs.CreateBitmap
For i = 1 To 5
CreateHaloEffectHelper(Parent,bmp, x, y, clr, radius)
Sleep(800)
Next
End Sub
Sub CreateHaloEffectHelper (Parent As B4XView,bmp As B4XBitmap, x As Int, y As Int, clr As Int, radius As Int)
Dim iv As ImageView
iv.Initialize("")
Dim p As B4XView = iv
p.SetBitmap(bmp)
Parent.AddView(p, x, y, 0, 0)
Dim duration As Int = 3000
p.SetLayoutAnimated(duration, x - radius, y - radius, 2 * radius, 2 * radius)
p.SetVisibleAnimated(duration, False)
Sleep(duration)
p.RemoveViewFromParent
End Sub
But the moment I go to compile I have the following error:
Waiting for debugger to connect...
Program started.
Error occurred on line: 768 (Main)
java.lang.ClassCastException: class anywheresoftware.b4j.objects.Form cannot be cast to class javafx.scene.layout.Pane (anywheresoftware.b4j.objects.Form is in unnamed module of loader 'app'; javafx.scene.layout.Pane is in module javafx.graphics of loader 'app')
at anywheresoftware.b4j.objects.PaneWrapper.getNumberOfNodes(PaneWrapper.java:369)
at anywheresoftware.b4j.objects.PaneWrapper.AddNode(PaneWrapper.java:311)
at anywheresoftware.b4a.objects.B4XViewWrapper.AddView(B4XViewWrapper.java:523)
at b4j.example.main$ResumableSub_CreateHaloEffectHelper.resume(main.java:2567)
at b4j.example.main._createhaloeffecthelper(main.java:2517)
at b4j.example.main$ResumableSub_CreateHaloEffect.resume(main.java:1111)
at b4j.example.main._createhaloeffect(main.java:1023)
at b4j.example.main$ResumableSub_AppStart.resume(main.java:464)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
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 anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:136)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:85)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:467)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:541)
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)
Why ?
Thank you
Last edited: