Can someone tell me some things I could try to fix this problem?
I am using the MenuBar tutorial as a starting point for a new applet, and
somehow I broke it such that the drop-down menu stays visible and on top even
after I click on a menu item, and even after the Action has run.
I'll post the entire files if asked, but for now here are some fragments.
A typical menu item looks like
<Menu.Item action="newSettingsWindow">
<buttonData>
<content:MenuItemData text="New Settings Tab"
keyboardShortcut="SHIFT-P" />
</buttonData>
</Menu.Item>
Here is a typical action. The "document.bxml" file was extracted from the .zip
on the tutorials page as it was not in the download.
Action.getNamedActions().put("newSettingsWindow", new Action() {
@Override
public void perform(Component source) {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
bxmlSerializer.getNamespace().put("menuHandler", menuHandler);
Component tab;
try {
tab = new Border((Component)
bxmlSerializer.readObject(UniversalConsoleAppletWindow.class, "document.bxml"));
} catch (IOException exception) {
throw new RuntimeException(exception);
} catch (SerializationException exception) {
throw new RuntimeException(exception);
}
tab.setName("Settings");
addTab(tab);
TabPane.setTabData(tab, "Settings " +
tabPane.getTabs().getLength());
tabPane.setSelectedIndex(tabPane.getTabs().getLength() - 1);
}
});
Thanks,
Tim