Den 24.06.2011 11:17, skrev Edvin Syse:
I have a MenuButton where I want to create the menu dynamically before each time it is shown. Where should I attach a listener, and how should I populate the menu each time?
This seems to work, but is it the correct approach?

menuButton.getListPopup().getWindowStateListeners().add(new WindowStateListener.Adapter() {
    public void windowOpened(Window window) {
        Menu menu = new Menu();
        // Add sections and items
        menuButton.setMenu(menu);
        super.windowOpened(window);
    }
});

-- Edvin

Reply via email to