use of se.trixon.mapollage.Mapollage in project java-mapollage by trixon.
the class MainFrame method initActions.
private void initActions() {
mActionManager = ActionManager.getInstance().init(getRootPane().getActionMap(), getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
InputMap inputMap = mPopupMenu.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap actionMap = mPopupMenu.getActionMap();
Action action = new AbstractAction("HideMenu") {
@Override
public void actionPerformed(ActionEvent e) {
mPopupMenu.setVisible(false);
}
};
String key = "HideMenu";
actionMap.put(key, action);
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
inputMap.put(keyStroke, key);
// about
PomInfo pomInfo = new PomInfo(Mapollage.class, "se.trixon", "mapollage");
AboutModel aboutModel = new AboutModel(SystemHelper.getBundle(Mapollage.class, "about"), SystemHelper.getResourceAsImageIcon(MainFrame.class, "icon-1024px.png"));
aboutModel.setAppVersion(pomInfo.getVersion());
AboutPanel aboutPanel = new AboutPanel(aboutModel);
action = AboutPanel.getAction(MainFrame.this, aboutPanel);
getRootPane().getActionMap().put(ActionManager.ABOUT, action);
// File
quitMenuItem.setAction(mActionManager.getAction(ActionManager.QUIT));
// Profile
addMenuItem.setAction(mActionManager.getAction(ActionManager.ADD));
cloneMenuItem.setAction(mActionManager.getAction(ActionManager.CLONE));
renameMenuItem.setAction(mActionManager.getAction(ActionManager.RENAME));
removeMenuItem.setAction(mActionManager.getAction(ActionManager.REMOVE));
removeAllMenuItem.setAction(mActionManager.getAction(ActionManager.REMOVE_ALL));
// Tools
optionsMenuItem.setAction(mActionManager.getAction(ActionManager.OPTIONS));
// Help
helpMenuItem.setAction(mActionManager.getAction(ActionManager.HELP));
aboutDateFormatMenuItem.setAction(mActionManager.getAction(ActionManager.ABOUT_DATE_FORMAT));
aboutMenuItem.setAction(mActionManager.getAction(ActionManager.ABOUT));
// Toolbar
startButton.setAction(mActionManager.getAction(ActionManager.START));
cancelButton.setAction(mActionManager.getAction(ActionManager.CANCEL));
menuButton.setAction(mActionManager.getAction(ActionManager.MENU));
SwingHelper.clearText(toolBar);
}
Aggregations