* OMGraphic. You can provide a List of components to be displayed in a
* popup menu. You have to do the wiring for making the list components do
* something, though.
*/
public List getItemsForOMGraphicMenu(OMGraphic omg) {
final OMGraphic chosen = omg;
List l = new ArrayList();
JMenuItem which = new JMenuItem("Which");
which.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
String classname = chosen.getClass().getName();
fireRequestMessage("Which was chosen over "
+ classname.substring(classname.lastIndexOf('.') + 1));
}
});
JMenuItem why = new JMenuItem("Why");
why.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
String classname = chosen.getClass().getName();
fireRequestMessage("Why was chosen over "
+ classname.substring(classname.lastIndexOf('.') + 1));
}
});