B4J Question equivalent to invokeLater(new Runnable ??

Discussion in 'B4J Questions' started by Patent, Jul 14, 2019.

  1. Patent

    Patent Member Licensed User

    hi guys.

    whats the equivalent in B4J to this java code?:

    x.y.addEventListener(new EventAdapter() {
    public void error(someXYobject) {
                    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    "Failed to do something",
    in B4J i am doing that:
    Dim myListener As Object=someObject.CreateEventFromUI("x.y.interface","myEvents",False)
    "addListener",Array As Object(myListener))

    Sub myEvents_Event(MethodName As String,Args() As Object)
    Select MethodName
    Case "error"   
    'show dialog
      End Select
    End Sub

    Question is:
    Do i get the right ....invokeLater(new Runnable() {.....
    behaviour to safely call methods in swing classes from my Callback Sub?
    Same for JavaFX?

  2. Erel

    Erel Administrator Staff Member Licensed User

    As you are using CreateEventFromUI, the event is already invoked later. You don't need to do anything special.
    Patent likes this.
  3. Patent

    Patent Member Licensed User

    i was in hope for this! :)

    thanks Erel
  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