List of usage examples for java.awt.event ActionEvent ALT_MASK
int ALT_MASK
To view the source code for java.awt.event ActionEvent ALT_MASK.
Click Source Link
From source file:com.gele.tools.wow.wdbearmanager.WDBearManager.java
public void init(String[] args) { // copy ARGs/* w w w . ja va 2 s .c o m*/ this.parseCommandLine(args); // Usefull for debugging this.myLogger.debug("java.version: " + System.getProperty("java.version")); this.myLogger.debug("java.vendor: " + System.getProperty("java.vendor")); this.myLogger.debug("java.vendor.url: " + System.getProperty("java.vendor.url")); this.myLogger.debug("os.name: " + System.getProperty("os.name")); this.myLogger.debug("os.arch: " + System.getProperty("os.arch")); this.myLogger.debug("os.version: " + System.getProperty("os.version")); if (this.paramDBconfig.length() != 0) { this.WDB_DB_CONFIG_FILE = this.paramDBconfig; } WDBearManager_API myAPI = new WDBearManager_API(this.WDB_DB_CONFIG_FILE); // Create all tables // -> Needed for the updata script <- // -> Otherwise it may crash with an empty database try { myAPI.getCountOfTable("creaturecache"); myAPI.getCountOfTable("gameobjectcache"); myAPI.getCountOfTable("itemcache"); myAPI.getCountOfTable("itemnamecache"); myAPI.getCountOfTable("itemtextchaxhe"); myAPI.getCountOfTable("npccache"); myAPI.getCountOfTable("pagetextcache"); myAPI.getCountOfTable("questcache"); } catch (Exception ex) { // ignore ex.printStackTrace(); System.exit(0); } // Check, if database must be re-newed DBUpdater myDBU = new DBUpdater(); myDBU.checkForUpdate(myAPI); WDBearManager_I myWoWWDBearManager_API = myAPI; // // print out some statistics // if (this.useGUI == false) { boolean paramSpec = false; // ASSERT DTO_Interface myDTO = null; if (this.paramWdbfile.length() != 0) { paramSpec = true; // Open WDB try { this.items = myWoWWDBearManager_API.readWDBfile(this.paramWdbfile); } catch (Exception ex) { this.myLogger.error("Error reading the WDB file"); return; } // first dto -> to identify the data Iterator itWDBS = this.items.iterator(); if (itWDBS.hasNext()) { myDTO = (DTO_Interface) itWDBS.next(); } } // Create CSV? if (this.paramCSVFolder.length() != 0) { if (myDTO == null) { // NO WDB specified -> exit this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n"); usage(this.options); return; } File csvFile = new File(this.paramCSVFolder, myDTO.getTableName() + ".csv"); if (this.useVerbose) { this.myLogger.info("Creating CSV file: " + csvFile.getAbsolutePath()); } try { WriteCSV.writeCSV(new File(this.paramCSVFolder), this.items); this.myLogger.info("CSV file written: " + csvFile.getAbsolutePath()); } catch (Exception ex) { ex.printStackTrace(); this.myLogger.error("Error writing the CSV file"); return; } } // Create TXT? if (this.paramTXTFolder.length() != 0) { if (myDTO == null) { // NO WDB specified -> exit this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n"); usage(this.options); return; } if (this.useVerbose) { String table = myDTO.getTableName(); File txtFile = new File(this.paramTXTFolder, table + ".txt"); this.myLogger.info("Creating TXT file: " + txtFile.getAbsolutePath()); } try { WriteTXT.writeTXT(new File(this.paramTXTFolder), this.items); } catch (Exception ex) { //ex.printStackTrace(); this.myLogger.error("Error writing the TXT file: " + ex.getMessage()); return; } } // Store inside SQL database? if (this.writeSQL == true) { paramSpec = true; if (myDTO == null) { // NO WDB specified -> exit this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n"); usage(this.options); return; } if (this.useVerbose) { this.myLogger.info("Storing data inside SQL database"); } SQLManager myWriteSQL = null; try { myWriteSQL = new SQLManager(this.WDB_DB_CONFIG_FILE); ObjectsWritten myOWr = myWriteSQL.insertOrUpdateToSQLDB(this.items, this.doUpdate); this.myLogger.info("Operation successfull"); if (this.useVerbose) { this.myLogger.info("DB statistics"); this.myLogger.info("INSERT: " + myOWr.getNumInsert()); this.myLogger.info("UPDATE: " + myOWr.getNumUpdate()); this.myLogger.info("Error INSERT: " + myOWr.getNumErrorInsert()); this.myLogger.info("Error UPDATE: " + myOWr.getNumErrorUpdate()); if (this.doUpdate == false) { this.myLogger.info("Objects skipped: " + myOWr.getNumSkipped()); System.out.println("If you want to overwrite/update objects, use 'update' param"); } this.myLogger.info(WDBearManager.VERSION_INFO); } } catch (Exception ex) { ex.printStackTrace(); this.myLogger.error("Error importing to database"); this.myLogger.error(ex.getMessage()); return; } } // writeSQL // Patch *.SCP with contents of database if (this.paramSCPname.length() != 0) { if (this.paramPatchSCP.length() == 0) { this.myLogger.error("Error: You did not specify -" + WDBearManager.PATCH_SCP + "\n"); usage(this.options); return; } paramSpec = true; this.myLogger.info("Patch scp file with the contents of the database"); try { SCPWritten mySCPW = myWoWWDBearManager_API.patchSCP(this.paramSCPname, this.paramPatchSCP, this.patchUTF8, this.paramLocale); if (this.useVerbose) { this.myLogger.info("Merge statistics"); System.out.println("Entries in database: " + mySCPW.getNumInDB()); this.myLogger.info("Merged with SCP: " + mySCPW.getNumPatched()); this.myLogger.info("Patched IDs: " + mySCPW.getPatchedIDs()); } this.myLogger.info("Patched file: " + this.paramSCPname + "_patch"); } catch (WDBMgr_IOException ex) { this.myLogger.error("The destination SCP file could not be created"); this.myLogger.error(ex.getMessage()); return; } catch (WDBMgr_NoDataAvailableException ex) { this.myLogger.info("Merging impossible"); this.myLogger.info("There are no entries inside the database"); } catch (Exception ex) { this.myLogger.error("Error while merging quests.scp with database"); this.myLogger.error(ex.getMessage()); return; } } // PatchSCP // Call jython script? if (this.paramScript.length() != 0) { paramSpec = true; this.myLogger.info("Calling Jython script"); this.myLogger.info("---"); PythonInterpreter interp = new PythonInterpreter(); interp.set("wdbmgrapi", myWoWWDBearManager_API); // set parameters Set setKeys = this.paramJython.keySet(); Iterator itKeys = setKeys.iterator(); String jyParam = ""; while (itKeys.hasNext()) { jyParam = (String) itKeys.next(); interp.set(jyParam, (String) this.paramJython.get(jyParam)); } interp.execfile(this.paramScript); this.myLogger.info("---"); System.out.println("Jython script executed, " + WDBearManager.VERSION_INFO); return; } // paramScript if (paramSpec == false) { usage(this.options); return; } // Exit return; } // Command Line Version // // GUI // PlasticLookAndFeel.setMyCurrentTheme(new DesertBlue()); try { UIManager.put("ClassLoader", LookUtils.class.getClassLoader()); UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); } catch (Exception e) { } // try { // com.incors.plaf.kunststoff.KunststoffLookAndFeel kunststoffLnF = new com.incors.plaf.kunststoff.KunststoffLookAndFeel(); // KunststoffLookAndFeel // .setCurrentTheme(new com.incors.plaf.kunststoff.KunststoffTheme()); // UIManager.setLookAndFeel(kunststoffLnF); // } catch (javax.swing.UnsupportedLookAndFeelException ex) { // // handle exception or not, whatever you prefer // } // this line needs to be implemented in order to make JWS work properly UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader()); this.setTitle(WDBearManager.VERSION_INFO); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.getContentPane().setLayout(new BorderLayout()); // construct GUI to display the stuff // Menu // Where the GUI is created: JMenuBar menuBar; JMenu menu; //, submenu; JMenuItem menuItem; //JRadioButtonMenuItem rbMenuItem; //JCheckBoxMenuItem cbMenuItem; // Create the menu bar. menuBar = new JMenuBar(); // Build the first menu. menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_A); menu.getAccessibleContext().setAccessibleDescription("Process WDB files"); menuBar.add(menu); // Exit menuItem = new JMenuItem(MENU_EXIT, KeyEvent.VK_T); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Exit program"); menuItem.addActionListener(this); menu.add(menuItem); // Build the first menu. menu = new JMenu("About"); menu.setMnemonic(KeyEvent.VK_A); menu.getAccessibleContext().setAccessibleDescription("Whassup?"); menuBar.add(menu); // Help menuItem = new JMenuItem(MENU_HELP, KeyEvent.VK_H); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Help me..."); menuItem.addActionListener(this); menu.add(menuItem); // JavaDocs menuItem = new JMenuItem(MENU_JDOCS, KeyEvent.VK_J); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, ActionEvent.ALT_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Show API docs..."); menuItem.addActionListener(this); menu.add(menuItem); // separator menu.addSeparator(); // CheckForUpdate menuItem = new JMenuItem(MENU_CHECKUPDATE, KeyEvent.VK_U); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.ALT_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Check for update..."); menuItem.addActionListener(this); menu.add(menuItem); // separator menu.addSeparator(); // ABOUT menuItem = new JMenuItem(MENU_ABOUT, KeyEvent.VK_T); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.ALT_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Ueber..."); menuItem.addActionListener(this); menu.add(menuItem); this.setJMenuBar(menuBar); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(0, 1)); JTabbedPane tabbedPane = new JTabbedPane(); ImageIcon wowIcon = createImageIcon("images/fromdisk.gif"); JComponent panel1 = new WDB_Panel(myWoWWDBearManager_API); tabbedPane.addTab("WDB-Module", wowIcon, panel1, "Handle WDB files"); tabbedPane.setMnemonicAt(0, KeyEvent.VK_1); ImageIcon panelIcon = createImageIcon("images/hsql.gif"); JComponent panel2 = null; try { panel2 = new SQL_Panel(myWoWWDBearManager_API); } catch (Throwable ex) { System.err.println("Error while instantiating SQL Panel: "); System.err.println(ex.getMessage()); ex.printStackTrace(); System.exit(0); } tabbedPane.addTab("DB-Module", panelIcon, panel2, "Handle database"); tabbedPane.setMnemonicAt(1, KeyEvent.VK_2); panelIcon = createImageIcon("images/pythonpoweredsmall.gif"); JComponent panel3 = new Python_Panel(myWoWWDBearManager_API); tabbedPane.addTab("Scripts", panelIcon, panel3, "Scripting"); tabbedPane.setMnemonicAt(2, KeyEvent.VK_3); // maybe user PLUGIN availabe // -> check for folders below "plugins" File filUserPanels = new File("plugins"); // 1) find user plugins (scan for directories) // 2) scan for <name>.properties, where <name> is the name of the directory // 3) load the properties file and get the plugin running String[] strUserPlugins = filUserPanels.list(new FilenameFilter() { public boolean accept(File dir, String name) { return (new File(dir, name).isDirectory()); } }); if (strUserPlugins != null) { ArrayList urlJars = new ArrayList(); //URL[] urlJars = new URL[strUserPlugins.length]; String strCurrJar = ""; String strPlugins[] = new String[strUserPlugins.length]; try { for (int i = 0; i < strUserPlugins.length; i++) { File baseFile = new File("plugins", strUserPlugins[i]); File filProperties = new File(baseFile, strUserPlugins[i] + ".properties"); if (filProperties.exists()) { // set plugin folder and .properties name strPlugins[i] = strUserPlugins[i]; this.myLogger.info("Found 'plugin' : " + baseFile.getAbsolutePath()); this.myLogger.info(" Trying to load .jar file"); // Scan for JAR files and include them //System.out.println(baseFile.getAbsolutePath()); String[] strJars = baseFile.list(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".jar"); } }); for (int j = 0; j < strJars.length; j++) { File filJAR = new File(baseFile, strJars[j]); strCurrJar = filJAR.getAbsolutePath(); this.myLogger.info("Loading external 'plugin' JAR: " + strCurrJar); URL jarfile = new URL("jar", "", "file:" + strCurrJar + "!/"); urlJars.add(jarfile); } } else { // print warning - a directory inside plugins, but there is no plugin this.myLogger.warn("Found directory inside plugins folder, but no .properties file"); this.myLogger.warn(" Name of directory: " + strUserPlugins[i]); this.myLogger.warn(" Please review the directory!"); } } // for... all user plugins } catch (Exception ex) { this.myLogger.error("Plugin: Error loading " + strCurrJar); this.myLogger.error("Please check your 'plugin' folder"); } URLClassLoader cl = null; try { // File file = new File("plugins", strUserJars[i]); // this.myLogger.info("Lade externes JAR: " + file.getAbsolutePath()); // URL jarfile = new URL("jar", "", "file:" + file.getAbsolutePath() + "!/"); URL[] loadURLs = new URL[urlJars.toArray().length]; for (int j = 0; j < urlJars.toArray().length; j++) { loadURLs[j] = (URL) urlJars.get(j); } cl = URLClassLoader.newInstance(loadURLs); Thread.currentThread().setContextClassLoader(cl); // String lcStr = "Test"; // Class loadedClass = cl.loadClass(lcStr); // this.myLogger.info("Smooth..."); } catch (Exception ex) { ex.printStackTrace(); } // 2) load properties and instantiate the plugin // String[] strPlugins = filUserPanels.list(new FilenameFilter() { // public boolean accept(File dir, String name) { // return (name.endsWith("_plugin.properties")); // } // }); String strPluginName = ""; String strPluginClass = ""; String strPluginImage = ""; WDBearPlugin pluginPanel = null; for (int i = 0; i < strPlugins.length; i++) { //this.myLogger.info(strPlugins[i]); Properties prpPlugin = null; try { prpPlugin = ReadPropertiesFile.readProperties( new File("plugins", strPlugins[i] + "/" + strPlugins[i]).getAbsolutePath() + ".properties"); } catch (Exception ex) { this.myLogger.error("Error with plugin: " + strPlugins[i]); this.myLogger.error("Could not load properties file"); continue; } if ((strPluginClass = prpPlugin.getProperty(this.PLUGIN_CLASS)) == null) { this.myLogger.error("Error with plugin: " + strPlugins[i]); this.myLogger.error("Property '" + this.PLUGIN_CLASS + "' not found"); continue; } if ((strPluginName = prpPlugin.getProperty(this.PLUGIN_NAME)) == null) { this.myLogger.error("Error with plugin: " + strPlugins[i]); this.myLogger.error("Property '" + this.PLUGIN_NAME + "' not found"); continue; } if ((strPluginImage = prpPlugin.getProperty(this.PLUGIN_IMAGE)) == null) { this.myLogger.error("Error with plugin: " + strPlugins[i]); this.myLogger.error("Property '" + this.PLUGIN_IMAGE + "' not found"); continue; } File filPlgImg = new File("plugins", strPlugins[i] + "/" + strPluginImage); panelIcon = createImageIcon(filPlgImg.getAbsolutePath()); if (panelIcon == null) { this.myLogger.error("Error with plugin: " + strPlugins[i]); this.myLogger.error("Could not read image '" + strPluginImage + "'"); continue; } try { pluginPanel = (WDBearPlugin) (cl.loadClass(strPluginClass).newInstance()); pluginPanel.runPlugin(myAPI); } catch (Exception ex) { this.myLogger.error("Error with plugin: " + strPlugins[i]); this.myLogger.error("Could not instantiate '" + strPluginClass + "'"); ex.printStackTrace(); continue; } tabbedPane.addTab(strPluginName, panelIcon, pluginPanel, strPluginName); } // Plugins } // plugins folder found mainPanel.add(tabbedPane); this.getContentPane().add(mainPanel, BorderLayout.CENTER); this.setSize(1024, 768); //this.pack(); this.show(); }
From source file:com.net2plan.gui.tools.GUINetworkDesign.java
private void addAllKeyCombinationActions() { addKeyCombinationAction("Resets the tool", new AbstractAction() { @Override// w w w . j a v a2s . com public void actionPerformed(ActionEvent e) { resetButton(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Outputs current design to console", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println(getDesign().toString()); } }, KeyStroke.getKeyStroke(KeyEvent.VK_F11, InputEvent.CTRL_DOWN_MASK)); /* FROM THE OFFLINE ALGORITHM EXECUTION */ addKeyCombinationAction("Execute algorithm", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { executionPane.doClickInExecutionButton(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK)); /* From the TOPOLOGY PANEL */ addKeyCombinationAction("Load design", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { topologyPanel.loadDesign(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Save design", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { topologyPanel.saveDesign(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Zoom in", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (topologyPanel.getSize().getWidth() != 0 && topologyPanel.getSize().getHeight() != 0) topologyPanel.getCanvas().zoomIn(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_DOWN_MASK), KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Zoom out", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (topologyPanel.getSize().getWidth() != 0 && topologyPanel.getSize().getHeight() != 0) topologyPanel.getCanvas().zoomOut(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_DOWN_MASK), KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Zoom all", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (topologyPanel.getSize().getWidth() != 0 && topologyPanel.getSize().getHeight() != 0) topologyPanel.getCanvas().zoomAll(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_MULTIPLY, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Take snapshot", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { topologyPanel.takeSnapshot(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_F12, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Load traffic demands", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { topologyPanel.loadTrafficDemands(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK)); /* FROM REPORT */ addKeyCombinationAction("Close selected report", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { int tab = reportPane.getReportContainer().getSelectedIndex(); if (tab == -1) return; reportPane.getReportContainer().remove(tab); } }, KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)); addKeyCombinationAction("Close all reports", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { reportPane.getReportContainer().removeAll(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); /* Online simulation */ addKeyCombinationAction("Run simulation", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { try { if (onlineSimulationPane.isRunButtonEnabled()) onlineSimulationPane.runSimulation(false); } catch (Net2PlanException ex) { if (ErrorHandling.isDebugEnabled()) ErrorHandling.addErrorOrException(ex, OnlineSimulationPane.class); ErrorHandling.showErrorDialog(ex.getMessage(), "Error executing simulation"); } catch (Throwable ex) { ErrorHandling.addErrorOrException(ex, OnlineSimulationPane.class); ErrorHandling.showErrorDialog("An error happened"); } } }, KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK)); // Windows addKeyCombinationAction("Show control window", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { WindowController.showTablesWindow(true); } }, KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK + ActionEvent.SHIFT_MASK)); viewEditTopTables.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)); viewEditTopTables.setActionMap(this.getActionMap()); reportPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)); reportPane.setActionMap(this.getActionMap()); executionPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)); executionPane.setActionMap(this.getActionMap()); onlineSimulationPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)); onlineSimulationPane.setActionMap(this.getActionMap()); whatIfAnalysisPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)); whatIfAnalysisPane.setActionMap(this.getActionMap()); }
From source file:ro.nextreports.designer.querybuilder.QueryBuilderPanel.java
public void setTabMnemonicAt(int index, int keyCode) { ActionListener action = new MnemonicTabAction(index); KeyStroke stroke = KeyStroke.getKeyStroke(keyCode, ActionEvent.ALT_MASK); tabbedPane.registerKeyboardAction(action, stroke, JTabbedPane.WHEN_IN_FOCUSED_WINDOW); }
From source file:com.nikonhacker.gui.EmulatorUI.java
@SuppressWarnings("MagicConstant") protected JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenuItem tmpMenuItem;/*w ww .j a v a2 s .co m*/ //Set up the file menu. JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu); //load image for (int chip = 0; chip < 2; chip++) { loadMenuItem[chip] = new JMenuItem("Load " + Constants.CHIP_LABEL[chip] + " firmware image"); if (chip == Constants.CHIP_FR) loadMenuItem[chip].setMnemonic(KEY_EVENT_LOAD); loadMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_LOAD, KEY_CHIP_MODIFIER[chip])); loadMenuItem[chip].setActionCommand(COMMAND_IMAGE_LOAD[chip]); loadMenuItem[chip].addActionListener(this); fileMenu.add(loadMenuItem[chip]); } fileMenu.add(new JSeparator()); //decoder tmpMenuItem = new JMenuItem("Decode firmware"); tmpMenuItem.setMnemonic(KeyEvent.VK_D); tmpMenuItem.setActionCommand(COMMAND_DECODE); tmpMenuItem.addActionListener(this); fileMenu.add(tmpMenuItem); //encoder tmpMenuItem = new JMenuItem("Encode firmware (alpha)"); tmpMenuItem.setMnemonic(KeyEvent.VK_E); tmpMenuItem.setActionCommand(COMMAND_ENCODE); tmpMenuItem.addActionListener(this); // fileMenu.add(tmpMenuItem); fileMenu.add(new JSeparator()); //decoder tmpMenuItem = new JMenuItem("Decode lens correction data"); //tmpMenuItem.setMnemonic(KeyEvent.VK_D); tmpMenuItem.setActionCommand(COMMAND_DECODE_NKLD); tmpMenuItem.addActionListener(this); fileMenu.add(tmpMenuItem); fileMenu.add(new JSeparator()); //Save state tmpMenuItem = new JMenuItem("Save state"); tmpMenuItem.setActionCommand(COMMAND_SAVE_STATE); tmpMenuItem.addActionListener(this); fileMenu.add(tmpMenuItem); //Load state tmpMenuItem = new JMenuItem("Load state"); tmpMenuItem.setActionCommand(COMMAND_LOAD_STATE); tmpMenuItem.addActionListener(this); fileMenu.add(tmpMenuItem); fileMenu.add(new JSeparator()); //quit tmpMenuItem = new JMenuItem("Quit"); tmpMenuItem.setMnemonic(KEY_EVENT_QUIT); tmpMenuItem.setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_QUIT, ActionEvent.ALT_MASK)); tmpMenuItem.setActionCommand(COMMAND_QUIT); tmpMenuItem.addActionListener(this); fileMenu.add(tmpMenuItem); //Set up the run menu. JMenu runMenu = new JMenu("Run"); runMenu.setMnemonic(KeyEvent.VK_R); menuBar.add(runMenu); for (int chip = 0; chip < 2; chip++) { //emulator play playMenuItem[chip] = new JMenuItem("Start (or resume) " + Constants.CHIP_LABEL[chip] + " emulator"); playMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_RUN[chip], ActionEvent.ALT_MASK)); playMenuItem[chip].setActionCommand(COMMAND_EMULATOR_PLAY[chip]); playMenuItem[chip].addActionListener(this); runMenu.add(playMenuItem[chip]); //emulator debug debugMenuItem[chip] = new JMenuItem("Debug " + Constants.CHIP_LABEL[chip] + " emulator"); debugMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_DEBUG[chip], ActionEvent.ALT_MASK)); debugMenuItem[chip].setActionCommand(COMMAND_EMULATOR_DEBUG[chip]); debugMenuItem[chip].addActionListener(this); runMenu.add(debugMenuItem[chip]); //emulator pause pauseMenuItem[chip] = new JMenuItem("Pause " + Constants.CHIP_LABEL[chip] + " emulator"); pauseMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_PAUSE[chip], ActionEvent.ALT_MASK)); pauseMenuItem[chip].setActionCommand(COMMAND_EMULATOR_PAUSE[chip]); pauseMenuItem[chip].addActionListener(this); runMenu.add(pauseMenuItem[chip]); //emulator step stepMenuItem[chip] = new JMenuItem("Step " + Constants.CHIP_LABEL[chip] + " emulator"); stepMenuItem[chip].setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_STEP[chip], ActionEvent.ALT_MASK)); stepMenuItem[chip].setActionCommand(COMMAND_EMULATOR_STEP[chip]); stepMenuItem[chip].addActionListener(this); runMenu.add(stepMenuItem[chip]); //emulator stop stopMenuItem[chip] = new JMenuItem("Stop and reset " + Constants.CHIP_LABEL[chip] + " emulator"); stopMenuItem[chip].setActionCommand(COMMAND_EMULATOR_STOP[chip]); stopMenuItem[chip].addActionListener(this); runMenu.add(stopMenuItem[chip]); runMenu.add(new JSeparator()); //setup breakpoints breakpointMenuItem[chip] = new JMenuItem("Setup " + Constants.CHIP_LABEL[chip] + " breakpoints"); breakpointMenuItem[chip].setActionCommand(COMMAND_SETUP_BREAKPOINTS[chip]); breakpointMenuItem[chip].addActionListener(this); runMenu.add(breakpointMenuItem[chip]); if (chip == Constants.CHIP_FR) { runMenu.add(new JSeparator()); } } //Set up the components menu. JMenu componentsMenu = new JMenu("Components"); componentsMenu.setMnemonic(KeyEvent.VK_O); menuBar.add(componentsMenu); for (int chip = 0; chip < 2; chip++) { //CPU state cpuStateMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " CPU State window"); if (chip == Constants.CHIP_FR) cpuStateMenuItem[chip].setMnemonic(KEY_EVENT_CPUSTATE); cpuStateMenuItem[chip] .setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_CPUSTATE, KEY_CHIP_MODIFIER[chip])); cpuStateMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CPUSTATE_WINDOW[chip]); cpuStateMenuItem[chip].addActionListener(this); componentsMenu.add(cpuStateMenuItem[chip]); //memory hex editor memoryHexEditorMenuItem[chip] = new JCheckBoxMenuItem( Constants.CHIP_LABEL[chip] + " Memory hex editor"); if (chip == Constants.CHIP_FR) memoryHexEditorMenuItem[chip].setMnemonic(KEY_EVENT_MEMORY); memoryHexEditorMenuItem[chip] .setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_MEMORY, KEY_CHIP_MODIFIER[chip])); memoryHexEditorMenuItem[chip].setActionCommand(COMMAND_TOGGLE_MEMORY_HEX_EDITOR[chip]); memoryHexEditorMenuItem[chip].addActionListener(this); componentsMenu.add(memoryHexEditorMenuItem[chip]); //Interrupt controller interruptControllerMenuItem[chip] = new JCheckBoxMenuItem( Constants.CHIP_LABEL[chip] + " interrupt controller"); interruptControllerMenuItem[chip].setActionCommand(COMMAND_TOGGLE_INTERRUPT_CONTROLLER_WINDOW[chip]); interruptControllerMenuItem[chip].addActionListener(this); componentsMenu.add(interruptControllerMenuItem[chip]); //Programmble timers programmableTimersMenuItem[chip] = new JCheckBoxMenuItem( Constants.CHIP_LABEL[chip] + " programmable timers"); programmableTimersMenuItem[chip].setActionCommand(COMMAND_TOGGLE_PROGRAMMABLE_TIMERS_WINDOW[chip]); programmableTimersMenuItem[chip].addActionListener(this); componentsMenu.add(programmableTimersMenuItem[chip]); //Serial interface serialInterfacesMenuItem[chip] = new JCheckBoxMenuItem( Constants.CHIP_LABEL[chip] + " serial interfaces"); serialInterfacesMenuItem[chip].setActionCommand(COMMAND_TOGGLE_SERIAL_INTERFACES[chip]); serialInterfacesMenuItem[chip].addActionListener(this); componentsMenu.add(serialInterfacesMenuItem[chip]); // I/O ioPortsMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " I/O ports"); ioPortsMenuItem[chip].setActionCommand(COMMAND_TOGGLE_IO_PORTS_WINDOW[chip]); ioPortsMenuItem[chip].addActionListener(this); componentsMenu.add(ioPortsMenuItem[chip]); //Serial devices serialDevicesMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " serial devices"); serialDevicesMenuItem[chip].setActionCommand(COMMAND_TOGGLE_SERIAL_DEVICES[chip]); serialDevicesMenuItem[chip].addActionListener(this); componentsMenu.add(serialDevicesMenuItem[chip]); componentsMenu.add(new JSeparator()); } //screen emulator: FR80 only screenEmulatorMenuItem = new JCheckBoxMenuItem("Screen emulator (FR only)"); screenEmulatorMenuItem.setMnemonic(KEY_EVENT_SCREEN); screenEmulatorMenuItem.setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_SCREEN, ActionEvent.ALT_MASK)); screenEmulatorMenuItem.setActionCommand(COMMAND_TOGGLE_SCREEN_EMULATOR); screenEmulatorMenuItem.addActionListener(this); componentsMenu.add(screenEmulatorMenuItem); //Component 4006: FR80 only component4006MenuItem = new JCheckBoxMenuItem("Component 4006 window (FR only)"); component4006MenuItem.setMnemonic(KeyEvent.VK_4); component4006MenuItem.setActionCommand(COMMAND_TOGGLE_COMPONENT_4006_WINDOW); component4006MenuItem.addActionListener(this); componentsMenu.add(component4006MenuItem); componentsMenu.add(new JSeparator()); //A/D converter: TX19 only for now adConverterMenuItem[Constants.CHIP_TX] = new JCheckBoxMenuItem( Constants.CHIP_LABEL[Constants.CHIP_TX] + " A/D converter (TX only)"); adConverterMenuItem[Constants.CHIP_TX].setActionCommand(COMMAND_TOGGLE_AD_CONVERTER[Constants.CHIP_TX]); adConverterMenuItem[Constants.CHIP_TX].addActionListener(this); componentsMenu.add(adConverterMenuItem[Constants.CHIP_TX]); //Front panel: TX19 only frontPanelMenuItem = new JCheckBoxMenuItem("Front panel (TX only)"); frontPanelMenuItem.setActionCommand(COMMAND_TOGGLE_FRONT_PANEL); frontPanelMenuItem.addActionListener(this); componentsMenu.add(frontPanelMenuItem); //Set up the trace menu. JMenu traceMenu = new JMenu("Trace"); traceMenu.setMnemonic(KeyEvent.VK_C); menuBar.add(traceMenu); for (int chip = 0; chip < 2; chip++) { //memory activity viewer memoryActivityViewerMenuItem[chip] = new JCheckBoxMenuItem( Constants.CHIP_LABEL[chip] + " Memory activity viewer"); memoryActivityViewerMenuItem[chip].setActionCommand(COMMAND_TOGGLE_MEMORY_ACTIVITY_VIEWER[chip]); memoryActivityViewerMenuItem[chip].addActionListener(this); traceMenu.add(memoryActivityViewerMenuItem[chip]); //disassembly disassemblyMenuItem[chip] = new JCheckBoxMenuItem( "Real-time " + Constants.CHIP_LABEL[chip] + " disassembly log"); if (chip == Constants.CHIP_FR) disassemblyMenuItem[chip].setMnemonic(KEY_EVENT_REALTIME_DISASSEMBLY); disassemblyMenuItem[chip].setAccelerator( KeyStroke.getKeyStroke(KEY_EVENT_REALTIME_DISASSEMBLY, KEY_CHIP_MODIFIER[chip])); disassemblyMenuItem[chip].setActionCommand(COMMAND_TOGGLE_DISASSEMBLY_WINDOW[chip]); disassemblyMenuItem[chip].addActionListener(this); traceMenu.add(disassemblyMenuItem[chip]); //Custom logger customMemoryRangeLoggerMenuItem[chip] = new JCheckBoxMenuItem( "Custom " + Constants.CHIP_LABEL[chip] + " logger window"); customMemoryRangeLoggerMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CUSTOM_LOGGER_WINDOW[chip]); customMemoryRangeLoggerMenuItem[chip].addActionListener(this); traceMenu.add(customMemoryRangeLoggerMenuItem[chip]); //Call Stack logger callStackMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " Call stack logger"); callStackMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CALL_STACK_WINDOW[chip]); callStackMenuItem[chip].addActionListener(this); traceMenu.add(callStackMenuItem[chip]); //ITRON Object iTronObjectMenuItem[chip] = new JCheckBoxMenuItem("ITRON " + Constants.CHIP_LABEL[chip] + " Objects"); iTronObjectMenuItem[chip].setActionCommand(COMMAND_TOGGLE_ITRON_OBJECT_WINDOW[chip]); iTronObjectMenuItem[chip].addActionListener(this); traceMenu.add(iTronObjectMenuItem[chip]); //ITRON Return Stack iTronReturnStackMenuItem[chip] = new JCheckBoxMenuItem( "ITRON " + Constants.CHIP_LABEL[chip] + " Return stack"); iTronReturnStackMenuItem[chip].setActionCommand(COMMAND_TOGGLE_ITRON_RETURN_STACK_WINDOW[chip]); iTronReturnStackMenuItem[chip].addActionListener(this); traceMenu.add(iTronReturnStackMenuItem[chip]); traceMenu.add(new JSeparator()); } //Set up the source menu. JMenu sourceMenu = new JMenu("Source"); sourceMenu.setMnemonic(KEY_EVENT_SCREEN); menuBar.add(sourceMenu); // FR syscall symbols generateSysSymbolsMenuItem = new JMenuItem( "Generate " + Constants.CHIP_LABEL[Constants.CHIP_FR] + " system call symbols"); generateSysSymbolsMenuItem.setActionCommand(COMMAND_GENERATE_SYS_SYMBOLS); generateSysSymbolsMenuItem.addActionListener(this); sourceMenu.add(generateSysSymbolsMenuItem); for (int chip = 0; chip < 2; chip++) { sourceMenu.add(new JSeparator()); //analyse / disassemble analyseMenuItem[chip] = new JMenuItem("Analyse / Disassemble " + Constants.CHIP_LABEL[chip] + " code"); analyseMenuItem[chip].setActionCommand(COMMAND_ANALYSE_DISASSEMBLE[chip]); analyseMenuItem[chip].addActionListener(this); sourceMenu.add(analyseMenuItem[chip]); sourceMenu.add(new JSeparator()); //code structure codeStructureMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " code structure"); codeStructureMenuItem[chip].setActionCommand(COMMAND_TOGGLE_CODE_STRUCTURE_WINDOW[chip]); codeStructureMenuItem[chip].addActionListener(this); sourceMenu.add(codeStructureMenuItem[chip]); //source code sourceCodeMenuItem[chip] = new JCheckBoxMenuItem(Constants.CHIP_LABEL[chip] + " source code"); if (chip == Constants.CHIP_FR) sourceCodeMenuItem[chip].setMnemonic(KEY_EVENT_SOURCE); sourceCodeMenuItem[chip] .setAccelerator(KeyStroke.getKeyStroke(KEY_EVENT_SOURCE, KEY_CHIP_MODIFIER[chip])); sourceCodeMenuItem[chip].setActionCommand(COMMAND_TOGGLE_SOURCE_CODE_WINDOW[chip]); sourceCodeMenuItem[chip].addActionListener(this); sourceMenu.add(sourceCodeMenuItem[chip]); if (chip == Constants.CHIP_FR) { sourceMenu.add(new JSeparator()); } } //Set up the tools menu. JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic(KeyEvent.VK_T); menuBar.add(toolsMenu); for (int chip = 0; chip < 2; chip++) { // save/load memory area saveLoadMemoryMenuItem[chip] = new JMenuItem( "Save/Load " + Constants.CHIP_LABEL[chip] + " memory area"); saveLoadMemoryMenuItem[chip].setActionCommand(COMMAND_SAVE_LOAD_MEMORY[chip]); saveLoadMemoryMenuItem[chip].addActionListener(this); toolsMenu.add(saveLoadMemoryMenuItem[chip]); //chip options chipOptionsMenuItem[chip] = new JMenuItem(Constants.CHIP_LABEL[chip] + " options"); chipOptionsMenuItem[chip].setActionCommand(COMMAND_CHIP_OPTIONS[chip]); chipOptionsMenuItem[chip].addActionListener(this); toolsMenu.add(chipOptionsMenuItem[chip]); toolsMenu.add(new JSeparator()); } //disassembly options uiOptionsMenuItem = new JMenuItem("Preferences"); uiOptionsMenuItem.setActionCommand(COMMAND_UI_OPTIONS); uiOptionsMenuItem.addActionListener(this); toolsMenu.add(uiOptionsMenuItem); //Set up the help menu. JMenu helpMenu = new JMenu("?"); menuBar.add(helpMenu); //about JMenuItem aboutMenuItem = new JMenuItem("About"); aboutMenuItem.setActionCommand(COMMAND_ABOUT); aboutMenuItem.addActionListener(this); helpMenu.add(aboutMenuItem); // JMenuItem testMenuItem = new JMenuItem("Test"); // testMenuItem.setActionCommand(COMMAND_TEST); // testMenuItem.addActionListener(this); // helpMenu.add(testMenuItem); // Global "Keep in sync" setting menuBar.add(Box.createHorizontalGlue()); final JCheckBox syncEmulators = new JCheckBox("Keep emulators in sync"); syncEmulators.setSelected(prefs.isSyncPlay()); framework.getMasterClock().setSyncPlay(prefs.isSyncPlay()); syncEmulators.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { prefs.setSyncPlay(syncEmulators.isSelected()); framework.getMasterClock().setSyncPlay(syncEmulators.isSelected()); } }); menuBar.add(syncEmulators); return menuBar; }
From source file:com.marginallyclever.makelangelo.MainGUI.java
public void updateMenuBar() { JMenu menu, subMenu;/*from w w w. jav a 2 s . c o m*/ ButtonGroup group; int i; if (settingsPane != null) { buttonAdjustMachineSize.setEnabled(!isrunning); buttonAdjustPulleySize.setEnabled(!isrunning); buttonJogMotors .setEnabled(connectionToRobot != null && connectionToRobot.isRobotConfirmed() && !isrunning); buttonChangeTool.setEnabled(!isrunning); buttonAdjustTool.setEnabled(!isrunning); } if (preparePane != null) { buttonHilbertCurve.setEnabled(!isrunning); buttonText2GCODE.setEnabled(!isrunning); } if (driveControls != null) { boolean x = connectionToRobot != null && connectionToRobot.isRobotConfirmed(); driveControls.updateButtonAccess(x, isrunning); } menuBar.removeAll(); // File menu menu = new JMenu(translator.get("MenuMakelangelo")); menu.setMnemonic(KeyEvent.VK_F); menuBar.add(menu); subMenu = new JMenu(translator.get("MenuPreferences")); buttonAdjustSounds = new JMenuItem(translator.get("MenuSoundsTitle")); buttonAdjustSounds.addActionListener(this); subMenu.add(buttonAdjustSounds); buttonAdjustGraphics = new JMenuItem(translator.get("MenuGraphicsTitle")); buttonAdjustGraphics.addActionListener(this); subMenu.add(buttonAdjustGraphics); buttonAdjustLanguage = new JMenuItem(translator.get("MenuLanguageTitle")); buttonAdjustLanguage.addActionListener(this); subMenu.add(buttonAdjustLanguage); menu.add(subMenu); buttonCheckForUpdate = new JMenuItem(translator.get("MenuUpdate"), KeyEvent.VK_U); buttonCheckForUpdate.addActionListener(this); buttonCheckForUpdate.setEnabled(true); menu.add(buttonCheckForUpdate); buttonAbout = new JMenuItem(translator.get("MenuAbout"), KeyEvent.VK_A); buttonAbout.addActionListener(this); menu.add(buttonAbout); menu.addSeparator(); buttonExit = new JMenuItem(translator.get("MenuQuit"), KeyEvent.VK_Q); buttonExit.addActionListener(this); menu.add(buttonExit); // Connect menu subMenu = new JMenu(translator.get("MenuConnect")); subMenu.setEnabled(!isrunning); group = new ButtonGroup(); String[] connections = connectionManager.listConnections(); buttonPorts = new JRadioButtonMenuItem[connections.length]; for (i = 0; i < connections.length; ++i) { buttonPorts[i] = new JRadioButtonMenuItem(connections[i]); if (connectionToRobot != null && connectionToRobot.getRecentConnection().equals(connections[i]) && connectionToRobot.isConnectionOpen()) { buttonPorts[i].setSelected(true); } buttonPorts[i].addActionListener(this); group.add(buttonPorts[i]); subMenu.add(buttonPorts[i]); } subMenu.addSeparator(); buttonRescan = new JMenuItem(translator.get("MenuRescan"), KeyEvent.VK_N); buttonRescan.addActionListener(this); subMenu.add(buttonRescan); buttonDisconnect = new JMenuItem(translator.get("MenuDisconnect"), KeyEvent.VK_D); buttonDisconnect.addActionListener(this); buttonDisconnect.setEnabled(connectionToRobot != null && connectionToRobot.isConnectionOpen()); subMenu.add(buttonDisconnect); menuBar.add(subMenu); // view menu menu = new JMenu(translator.get("MenuPreview")); buttonZoomOut = new JMenuItem(translator.get("ZoomOut")); buttonZoomOut.addActionListener(this); buttonZoomOut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, ActionEvent.ALT_MASK)); menu.add(buttonZoomOut); buttonZoomIn = new JMenuItem(translator.get("ZoomIn"), KeyEvent.VK_EQUALS); buttonZoomIn.addActionListener(this); buttonZoomIn.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, ActionEvent.ALT_MASK)); menu.add(buttonZoomIn); buttonZoomToFit = new JMenuItem(translator.get("ZoomFit")); buttonZoomToFit.addActionListener(this); menu.add(buttonZoomToFit); menuBar.add(menu); // finish menuBar.updateUI(); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * File menu setup//from w ww. j av a2 s . co m * * @return The file menu */ private JMenu fileMenu() { JMenu menu; // File Menu menu = new JMenu(Resources.getString("mnuFileLabel")); menu.setMnemonic(Resources.getChar("mnuFileAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileDesc")); // File | Open SQL File fileOpenSQL = new JMenuItem(Resources.getString("mnuFileOpenLabel")); fileOpenSQL.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileOpenAccel"), ActionEvent.ALT_MASK)); fileOpenSQL.setMnemonic(Resources.getChar("mnuFileOpenAccel")); fileOpenSQL.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileOpenDesc")); fileOpenSQL.addActionListener(this); fileOpenSQL.setEnabled(true); menu.add(fileOpenSQL); menu.addSeparator(); // File | Log Stats fileLogStats = new JCheckBoxMenuItem(Resources.getString("mnuFileLogStatsLabel")); fileLogStats.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileLogStatsAccel"), ActionEvent.ALT_MASK)); fileLogStats.setMnemonic(Resources.getChar("mnuFileLogStatsAccel")); fileLogStats.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileLogStatsAccel", DBSTATS_NAME)); fileLogStats.setEnabled(true); fileLogStats.setSelected(false); menu.add(fileLogStats); // File | Log Results fileLogResults = new JCheckBoxMenuItem(Resources.getString("mnuFileLogResultsLabel")); fileLogResults.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileLogResultsAccel"), ActionEvent.ALT_MASK)); fileLogResults.setMnemonic(Resources.getString("mnuFileLogResultsAccel").charAt(0)); fileLogResults.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileLogResultsDesc", DBRESULTS_NAME)); fileLogResults.setEnabled(true); fileLogResults.setSelected(false); menu.add(fileLogResults); menu.addSeparator(); // File | Export Results As CSV fileSaveAsCSV = new JMenuItem(Resources.getString("mnuFileExportCSVLabel")); fileSaveAsCSV.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileExportCSVAccel"), ActionEvent.ALT_MASK)); fileSaveAsCSV.setMnemonic(Resources.getChar("mnuFileExportCSVAccel")); fileSaveAsCSV.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileExportCSVDesc")); fileSaveAsCSV.addActionListener(this); fileSaveAsCSV.setEnabled(false); menu.add(fileSaveAsCSV); // File | Export Results As Triples fileSaveAsTriples = new JMenuItem(Resources.getString("mnuFileExportTriplesLabel")); fileSaveAsTriples.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileExportTriplesAccel"), ActionEvent.ALT_MASK)); fileSaveAsTriples.setMnemonic(Resources.getChar("mnuFileExportTriplesAccel")); fileSaveAsTriples.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileExportTriplesDesc")); fileSaveAsTriples.addActionListener(new ExportResultsAsTriplesListener()); fileSaveAsTriples.setEnabled(false); menu.add(fileSaveAsTriples); // File | Save BLOBs fileSaveBLOBs = new JMenuItem(Resources.getString("mnuFileSaveBLOBLabel")); fileSaveBLOBs.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileSaveBLOBAccel"), ActionEvent.ALT_MASK)); fileSaveBLOBs.setMnemonic(Resources.getChar("mnuFileSaveBLOBAccel")); fileSaveBLOBs.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileSaveBLOBDesc")); fileSaveBLOBs.addActionListener(this); fileSaveBLOBs.setEnabled(false); menu.add(fileSaveBLOBs); menu.addSeparator(); // File | Raw Export fileExportsRaw = new JCheckBoxMenuItem(Resources.getString("mnuFileRawExportLabel")); fileExportsRaw.setMnemonic(Resources.getChar("mnuFileRawExportAccel")); fileExportsRaw.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileRawExportDesc")); fileExportsRaw.setEnabled(true); fileExportsRaw.setSelected(false); menu.add(fileExportsRaw); // File | No CR Added to Export fileNoCRAddedToExportRows = new JCheckBoxMenuItem(Resources.getString("mnuFileNoCRLabel")); fileNoCRAddedToExportRows.setMnemonic(Resources.getChar("mnuFileNoCRAccel")); fileNoCRAddedToExportRows.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuFileNoCRDesc")); fileNoCRAddedToExportRows.setEnabled(true); fileNoCRAddedToExportRows.setSelected(false); menu.add(fileNoCRAddedToExportRows); menu.addSeparator(); fileExit = new JMenuItem(Resources.getString("mnuFileExitLabel")); fileExit.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuFileExitAccel"), ActionEvent.ALT_MASK)); fileExit.setMnemonic(Resources.getChar("mnuFileExitAccel")); fileExit.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuFileExitDesc")); fileExit.addActionListener(this); fileExit.setEnabled(true); menu.add(fileExit); return menu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Edit menu setup/*from w w w.jav a 2 s. com*/ * * @return The edit menu */ private JMenu editMenu() { JMenu menu; // Edit Menu menu = new JMenu(Resources.getString("mnuEditLabel")); menu.setMnemonic(Resources.getChar("mnuEditAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditDesc")); // Edit | Copy editCopy = new JMenuItem(Resources.getString("mnuEditCopyLabel")); editCopy.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuEditCopyAccel"), ActionEvent.ALT_MASK)); editCopy.setMnemonic(Resources.getChar("mnuEditCopyAccel")); editCopy.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditCopyDesc")); editCopy.addActionListener(this); editCopy.setEnabled(true); menu.add(editCopy); // Edit | Select All editSelectAll = new JMenuItem(Resources.getString("mnuEditSelectAllLabel")); editSelectAll.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuEditSelectAllAccel"), ActionEvent.ALT_MASK)); editSelectAll.setMnemonic(Resources.getChar("mnuEditSelectAllAccel")); editSelectAll.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditSelectAllDesc")); editSelectAll.addActionListener(this); editSelectAll.setEnabled(true); menu.add(editSelectAll); menu.addSeparator(); // Edit | Sort by Selected Columns editSort = new JMenuItem(Resources.getString("mnuEditSortLabel")); editSort.setMnemonic(Resources.getChar("mnuEditSortAccel")); editSort.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuEditSortDesc")); editSort.addActionListener(this); editSort.setEnabled(true); menu.add(editSort); return menu; }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Query menu set/*w w w . j a v a 2 s . com*/ * * @return The query menu */ private JMenu queryMenu() { JMenu menu; // Query Menu menu = new JMenu(Resources.getString("mnuQueryLabel")); menu.setMnemonic(Resources.getChar("mnuQueryAccel")); menu.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryDesc")); // Query | Select Statement queryMakeVerboseSelect = new JMenuItem(Resources.getString("mnuQuerySelectLabel")); queryMakeVerboseSelect.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQuerySelectAccel"), ActionEvent.ALT_MASK)); queryMakeVerboseSelect.setMnemonic(Resources.getChar("mnuQuerySelectAccel")); queryMakeVerboseSelect.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuQuerySelectDesc")); queryMakeVerboseSelect.addActionListener(this); queryMakeVerboseSelect.setEnabled(true); menu.add(queryMakeVerboseSelect); // Query | Insert Statement queryMakeInsert = new JMenuItem(Resources.getString("mnuQueryInsertLabel")); queryMakeInsert.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryInsertAccel"), ActionEvent.ALT_MASK)); queryMakeInsert.setMnemonic(Resources.getChar("mnuQueryInsertAccel")); queryMakeInsert.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryInsertDesc")); queryMakeInsert.addActionListener(this); queryMakeInsert.setEnabled(true); menu.add(queryMakeInsert); // Query | Update Statement queryMakeUpdate = new JMenuItem(Resources.getString("mnuQueryUpdateLabel")); queryMakeUpdate.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryUpdateAccel"), ActionEvent.ALT_MASK)); queryMakeUpdate.setMnemonic(Resources.getChar("mnuQueryUpdateAccel")); queryMakeUpdate.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryUpdateDesc")); queryMakeUpdate.addActionListener(this); queryMakeUpdate.setEnabled(true); menu.add(queryMakeUpdate); menu.addSeparator(); // Query | Select * querySelectStar = new JMenuItem(Resources.getString("mnuQuerySelectStarLabel")); querySelectStar.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQuerySelectStarAccel"), ActionEvent.ALT_MASK)); querySelectStar.setMnemonic(Resources.getChar("mnuQuerySelectStarAccel")); querySelectStar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuQuerySelectStarDesc")); querySelectStar.addActionListener(this); querySelectStar.setEnabled(true); menu.add(querySelectStar); // Query | Describe Select * queryDescribeStar = new JMenuItem(Resources.getString("mnuQueryDescSelectStarLabel")); queryDescribeStar.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryDescSelectStarAccel"), ActionEvent.ALT_MASK)); queryDescribeStar.setMnemonic(Resources.getChar("mnuQueryDescSelectStarAccel")); queryDescribeStar.getAccessibleContext() .setAccessibleDescription(Resources.getString("mnuQueryDescSelectStarDesc")); queryDescribeStar.addActionListener(this); queryDescribeStar.setEnabled(true); menu.add(queryDescribeStar); menu.addSeparator(); // Query | Reorder Queries querySetOrder = new JMenuItem(Resources.getString("mnuQueryReorderLabel")); querySetOrder.setMnemonic(Resources.getChar("mnuQueryReorderAccel")); querySetOrder.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryReorderDesc")); querySetOrder.addActionListener(this); querySetOrder.setEnabled(true); menu.add(querySetOrder); menu.addSeparator(); // Query | Run All queryRunAll = new JMenuItem(Resources.getString("mnuQueryRunAllLabel")); queryRunAll.setAccelerator( KeyStroke.getKeyStroke(Resources.getChar("mnuQueryRunAllAccel"), ActionEvent.ALT_MASK)); queryRunAll.setMnemonic(Resources.getChar("mnuQueryRunAllAccel")); queryRunAll.getAccessibleContext().setAccessibleDescription(Resources.getString("mnuQueryRunAllDesc")); queryRunAll.addActionListener(this); queryRunAll.setEnabled(true); menu.add(queryRunAll); return menu; }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Configures the assertions file menu. Called at startup * and whenever an assertions file is opened or saved since * the list of recent assertions files is presented on the * file menu./*from w w w . j a v a2 s . c om*/ */ private void setupAssertionsFileMenu() { fileAssertionsMenu.removeAll(); fileOpenTriplesFile = new JMenuItem("Open Assertions File"); fileOpenTriplesFile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.ALT_MASK)); fileOpenTriplesFile.setMnemonic('A'); fileOpenTriplesFile.setToolTipText("Open an asserted triples file"); fileOpenTriplesFile.addActionListener(new FileAssertedTriplesOpenListener()); fileAssertionsMenu.add(fileOpenTriplesFile); fileOpenTriplesUrl = new JMenuItem("Open Assertions Url"); fileOpenTriplesUrl.setMnemonic('U'); fileOpenTriplesUrl.setToolTipText("Access asserted triples from a URL"); fileOpenTriplesUrl.addActionListener(new FileAssertedTriplesUrlOpenListener()); fileAssertionsMenu.add(fileOpenTriplesUrl); fileAssertionsMenu.addSeparator(); // Create menu options to open recently accessed ontology files fileOpenRecentTriplesFile = new JMenuItem[recentAssertionsFiles.size()]; for (int recentFileNumber = 0; recentFileNumber < recentAssertionsFiles.size(); ++recentFileNumber) { fileOpenRecentTriplesFile[recentFileNumber] = new JMenuItem( recentAssertionsFiles.get(recentFileNumber).getName()); fileOpenRecentTriplesFile[recentFileNumber] .setToolTipText(recentAssertionsFiles.get(recentFileNumber).getAbsolutePath()); fileOpenRecentTriplesFile[recentFileNumber] .addActionListener(new RecentAssertedTriplesFileOpenListener()); fileAssertionsMenu.add(fileOpenRecentTriplesFile[recentFileNumber]); } if (fileOpenRecentTriplesFile.length > 0) { fileAssertionsMenu.addSeparator(); } fileSaveTriplesToFile = new JMenuItem("Save Assertions Text"); fileSaveTriplesToFile .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.ALT_MASK | KeyEvent.CTRL_MASK)); fileSaveTriplesToFile.setMnemonic(KeyEvent.VK_S); fileSaveTriplesToFile.setToolTipText("Write the asserted triples to a file"); fileSaveTriplesToFile.addActionListener(new FileAssertedTriplesSaveListener()); fileAssertionsMenu.add(fileSaveTriplesToFile); fileSaveSerializedModel = new JMenuItem("Save Model (processed triples)"); fileSaveSerializedModel .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.ALT_MASK | KeyEvent.CTRL_MASK)); fileSaveSerializedModel.setMnemonic(KeyEvent.VK_M); fileSaveSerializedModel.setToolTipText("Write the triples from the current model to a file"); fileSaveSerializedModel.addActionListener(new ModelSerializerListener()); fileAssertionsMenu.add(fileSaveSerializedModel); fileAssertionsMenu.addSeparator(); fileExit = new JMenuItem("Exit"); fileExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK)); fileExit.setMnemonic(KeyEvent.VK_X); fileExit.setToolTipText("Exit the application"); fileExit.addActionListener(new EndApplicationListener()); fileAssertionsMenu.add(fileExit); }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Create the edit menu// ww w . ja v a2 s . c om * * @return The edit menu */ private JMenu setupEditMenu() { final JMenu menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); menu.setToolTipText("Menu items related to editing the ontology"); editFind = new JMenuItem("Find (in assertions)"); editFind.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_MASK)); editFind.setMnemonic(KeyEvent.VK_F); editFind.setToolTipText("Find text in the assertions editor"); editFind.addActionListener(new FindAssertionsTextListener()); menu.add(editFind); editFindNextMatch = new JMenuItem("Next (matching assertion text)"); editFindNextMatch.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)); editFindNextMatch.setMnemonic(KeyEvent.VK_N); editFindNextMatch.setToolTipText("Find next text match in the assertions editor"); editFindNextMatch.addActionListener(new FindNextAssertionsTextListener()); menu.add(editFindNextMatch); menu.addSeparator(); editCommentToggle = new JMenuItem("Toggle Comment"); editCommentToggle.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK)); editCommentToggle.setMnemonic(KeyEvent.VK_T); editCommentToggle .setToolTipText("Switch the chosen assertion or query lines between commented and not commented"); editCommentToggle.addActionListener(new CommentToggleListener()); editCommentToggle.setEnabled(false); menu.add(editCommentToggle); editInsertPrefixes = new JMenuItem("Insert Prefixes"); editInsertPrefixes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK)); editInsertPrefixes.setMnemonic(KeyEvent.VK_I); editInsertPrefixes.setToolTipText("Insert standard prefixes (namespaces)"); editInsertPrefixes.addActionListener(new InsertPrefixesListener()); menu.add(editInsertPrefixes); menu.addSeparator(); editExpandAllTreeNodes = new JMenuItem("Expand Entire Tree"); editExpandAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, ActionEvent.ALT_MASK)); editExpandAllTreeNodes.setMnemonic(KeyEvent.VK_E); editExpandAllTreeNodes.setToolTipText("Expand all tree nodes"); editExpandAllTreeNodes.addActionListener(new ExpandTreeListener()); menu.add(editExpandAllTreeNodes); editCollapseAllTreeNodes = new JMenuItem("Collapse Entire Tree"); editCollapseAllTreeNodes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, ActionEvent.ALT_MASK)); editCollapseAllTreeNodes.setMnemonic(KeyEvent.VK_C); editCollapseAllTreeNodes.setToolTipText("Expand all tree nodes"); editCollapseAllTreeNodes.addActionListener(new CollapseTreeListener()); menu.add(editCollapseAllTreeNodes); menu.addSeparator(); editEditListOfSparqlServiceUrls = new JMenuItem("Edit SPARQL Service URLs List"); editEditListOfSparqlServiceUrls.setMnemonic(KeyEvent.VK_S); editEditListOfSparqlServiceUrls.setToolTipText("Remove unwanted URLs from the dropdown list"); editEditListOfSparqlServiceUrls.addActionListener(new EditListOfSparqlServiceUrls()); menu.add(editEditListOfSparqlServiceUrls); return menu; }