B4J Question cursor after mouse over

tufanv

Expert
Licensed User
Longtime User
Hello

I want to show hand as cursor when user is on label , I can do that with :

Code: Copy
Sub lblweb_MouseMoved (EventData As MouseEvent)
    MainForm.RootPane.MouseCursor=fx.Cursors.HAND
End Sub

How can I change to default when mouse exit . ?

Thanks
 
You can set the MouseEntered and Exited eventhandlers using JavaObject:
Code: Copy
    Dim JO As JavaObject = lblWeb 'or Whichever Node you are tracking
    Dim O As Object = JO.CreateEventFromUI("javafx.event.EventHandler","MouseEntered",Null)
    JO.RunMethod("setOnMouseEntered",Array(O))
    Dim O As Object = JO.CreateEventFromUI("javafx.event.EventHandler","MouseExited",Null)
    JO.RunMethod("setOnMouseExited",Array(O))

Then

Code: Copy
Private Sub MouseEntered_Event (MethodName As String, Args() As Object)
  'Show the Hand cursor
 
End Sub

Private Sub MouseExited_Event (MethodName As String, Args() As Object)
'Show the default cursor
End Sub
 
Upvote 0
You can set the MouseEntered and Exited eventhandlers using JavaObject:
Code: Copy
    Dim JO As JavaObject = lblWeb 'or Whichever Node you are tracking
    Dim O As Object = JO.CreateEventFromUI("javafx.event.EventHandler","MouseEntered",Null)
    JO.RunMethod("setOnMouseEntered",Array(O))
    Dim O As Object = JO.CreateEventFromUI("javafx.event.EventHandler","MouseExited",Null)
    JO.RunMethod("setOnMouseExited",Array(O))

Then

Code: Copy
Private Sub MouseEntered_Event (MethodName As String, Args() As Object)
  'Show the Hand cursor

End Sub

Private Sub MouseExited_Event (MethodName As String, Args() As Object)
'Show the default cursor
End Sub

Works Perfect ! Thank you
 
Upvote 0
Back
Top