Menu, Toolbar and Popup actions - <Mapping to command class>
From: Abraham Khalil (akhalil_at_pacific.net.au)
Date: 10/04/03
- Next message: Amey Samant: "Re: How to make a executable file, such as myprogram.exe, for java ?"
- Previous message: Amey Samant: "Re: Probabilistic Data Structure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 3 Oct 2003 22:30:24 -0700
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...
}
}
- Next message: Amey Samant: "Re: How to make a executable file, such as myprogram.exe, for java ?"
- Previous message: Amey Samant: "Re: Probabilistic Data Structure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|