0

Hey basically

I have a Jpopmenu in my View class

My view also implements MouseListener

When I click on an object, my view sends a request to controller. Controller will then decide which behavior to give the JPopupmenu (what MenuItems it has) and return it to View, which then sets the Jpopupmenu in view to what was returned.

This works, I can click and all the items appear in the Jpopupmenu, but I have no idea what code I need to use to get those JmenuItems to do something when clicked?

The controller gets the behavior from a Menubehavior Interface, now I know I can put the code in the classes that implements Menubehavior and then extend ActionListener and get the items to do something in there, but I need the items to do something in View, as they send another request to controller when they do it which then updates my model

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by JamesCherrill
0

Your description isn't enough to go on really - eg what is the purpose of the Menubehaviour interface and where is that implemented (etc)?
Anyway, there's nothing wrong with adding Actionlistener(s) to your menu items in the View class. The actionPerformed method(s) can then immediately pass responsibility to the appropriate method(s) in the controller.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.