我的代碼是我如何知道哪個菜單項被點擊?
VerticalPanel v1 = new VerticalPanel();
Command comm = new Command() {
@Override
public void execute() {
// How i know that which menu item is cliked
}
};
MenuBar menu = new MenuBar();
menu.setWidth("500px");
menu.setAnimationEnabled(true);
menu.setAutoOpen(true);
menu.addSeparator();
MenuBar fileBar = new MenuBar(true);
MenuBar editBar = new MenuBar(true);
fileBar.addItem(new MenuItem("New", comm));
fileBar.addSeparator();
fileBar.addItem(new MenuItem("Open", comm));
fileBar.addItem(new MenuItem("Save", comm));
editBar.addItem("Edit 11", comm);
editBar.addItem("Edit 11", comm);
menu.addItem(new MenuItem("File", fileBar));
menu.addItem(new MenuItem("Edit", editBar));
v1.add(menu);
請幫我
添加監聽器在菜單上。 – Geo 2009-10-26 11:11:51
在GWT中沒有選項可以添加聽衆到菜單.... 你能告訴我確切的代碼 – 2009-10-26 11:16:41