Public Sub SetShadow (View As B4XView, Offset As Double, Color As Int)
#if B4J
Dim DropShadow As JavaObject
'You might prefer to ignore panels as the shadow is different.
'If View Is Pane Then Return
DropShadow.InitializeNewInstance(IIf(View Is Pane, "javafx.scene.effect.InnerShadow", "javafx.scene.effect.DropShadow"), Null)
DropShadow.RunMethod("setOffsetX", Array(Offset))
DropShadow.RunMethod("setOffsetY", Array(Offset))
DropShadow.RunMethod("setRadius", Array(Offset))
Dim fx As JFX
DropShadow.RunMethod("setColor", Array(fx.Colors.From32Bit(Color)))
View.As(JavaObject).RunMethod("setEffect", Array(DropShadow))
#Else If B4A
Offset = Offset * 2
View.As(JavaObject).RunMethod("setElevation", Array(Offset.As(Float)))
#Else If B4i
View.As(View).SetShadow(Color, Offset, Offset, 0.5, False)
#End If
End Sub