This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command Pattern

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I have a problem how to deal with Command pattern when two components are doing the same thing (JMenuItem and JButton). Having the same code twice in both command classes doesn't sound very good. Do you have any advice how to solve this problem?
Jukka
 
Mike Birken
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simply have each listener call the same method and put the code you would normally put in both listeners into that single method. BTW, what you are describing is not the Command Design Pattern.
- Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic