Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add my listener?  RSS feed

 
Joaquin Autumn
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I'd like to extend a tool with a listener. But up to now I have problems with doing that.
Hopefully you can help me. Here you can see the class I'd like to extend:
Class
I think the relevant parts are between line 85 and 93 and between 547 and 559. But I'm not 100 % sure. Maybe there is another code
relevant for you to help me. There is also an Interface I have to implement:
Interface

My aim is to create a new project. So far my code is in the same project like the code posted above (links).
So I created my listener:



Firstly I'm not sure if this is correct. Secondly I think I have to call the listener...but where and how?
If I call the listener within the MTextController class, I would get a circle if I put my code in my own project.
Maybe you can help me.

Regards
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I shall move you to our GUIs forum, where we usually discuss such questions. There is something peculiar about that Listener interface, that you are listening for creation of an editor pane, but have to pass a reference to it beforehand. I find that hard to understand, particularly since the documentation comments don't tell us what the method is supposed to do.

Maybe somebody else can help?
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there's enough information here about what you want to do.

Your class MyEditorPaneListener appears to be a listener, but it calls the method to add a listener and uses a different (anonymous inner) class instead. I don't know if your confusion is whether it is necessary to use an anonymous inner class or what.

I can spin a lot of words about listeners and so forth, but I don't know what you do and don't understand. Can you make your question more specific? I think it's the question that needs more explanation.

rc
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!