By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,468 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

Menu, Toolbar and Popup actions - <Mapping to command class>

P: n/a
With all the Menu items, toolbar items and popup items that can total to
about 50-75 choices in a gui design, what the 'easiest' way to map the
action names with the class to call.

Like to use the Command design pattern to do this generically:
Somehow get the "action string" and map it to a "command class".

Is this possible with Command, Reflection etc?
Somehow:

Command c = new <ReflectCallCommandClass> ();
c.execute();

How do the reflection part? More important if their is a better way
than this...
public interface Command {
public void execute();
}
public class MyCommandClass1 extends Command {
public void execute() {
// code for action 1,
// could be from Menu, Toolbar, popups doesn't matter...
}
}
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.