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.

Command Pattern

Anonymous

Ranch Hand

Posts: 18944

posted 14 years ago

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

posted 14 years ago

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