List of usage examples for java.awt.event KeyEvent VK_P
int VK_P
To view the source code for java.awt.event KeyEvent VK_P.
Click Source Link
From source file:org.apache.cayenne.modeler.CayenneModelerFrame.java
protected void initMenus() { getContentPane().setLayout(new BorderLayout()); JMenu fileMenu = new JMenu("File"); JMenu editMenu = new JMenu("Edit"); JMenu projectMenu = new JMenu("Project"); JMenu toolMenu = new JMenu("Tools"); JMenu helpMenu = new JMenu("Help"); fileMenu.setMnemonic(KeyEvent.VK_F); editMenu.setMnemonic(KeyEvent.VK_E); projectMenu.setMnemonic(KeyEvent.VK_P); toolMenu.setMnemonic(KeyEvent.VK_T); helpMenu.setMnemonic(KeyEvent.VK_H); fileMenu.add(getAction(NewProjectAction.class).buildMenu()); fileMenu.add(getAction(OpenProjectAction.class).buildMenu()); fileMenu.add(getAction(ProjectAction.class).buildMenu()); fileMenu.add(getAction(ImportDataMapAction.class).buildMenu()); fileMenu.addSeparator();/* w w w.j av a 2 s .c o m*/ fileMenu.add(getAction(SaveAction.class).buildMenu()); fileMenu.add(getAction(SaveAsAction.class).buildMenu()); fileMenu.add(getAction(RevertAction.class).buildMenu()); fileMenu.addSeparator(); editMenu.add(getAction(UndoAction.class).buildMenu()); editMenu.add(getAction(RedoAction.class).buildMenu()); editMenu.add(getAction(CutAction.class).buildMenu()); editMenu.add(getAction(CopyAction.class).buildMenu()); editMenu.add(getAction(PasteAction.class).buildMenu()); recentFileMenu = new RecentFileMenu("Recent Projects"); addRecentFileListListener(recentFileMenu); fileMenu.add(recentFileMenu); fileMenu.addSeparator(); fileMenu.add(getAction(ExitAction.class).buildMenu()); projectMenu.add(getAction(ValidateAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(CreateNodeAction.class).buildMenu()); projectMenu.add(getAction(CreateDataMapAction.class).buildMenu()); projectMenu.add(getAction(CreateObjEntityAction.class).buildMenu()); projectMenu.add(getAction(CreateEmbeddableAction.class).buildMenu()); projectMenu.add(getAction(CreateDbEntityAction.class).buildMenu()); projectMenu.add(getAction(CreateProcedureAction.class).buildMenu()); projectMenu.add(getAction(CreateQueryAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(ObjEntitySyncAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(RemoveAction.class).buildMenu()); toolMenu.add(getAction(ReverseEngineeringAction.class).buildMenu()); toolMenu.add(getAction(InferRelationshipsAction.class).buildMenu()); toolMenu.add(getAction(ImportEOModelAction.class).buildMenu()); toolMenu.addSeparator(); toolMenu.add(getAction(GenerateCodeAction.class).buildMenu()); toolMenu.add(getAction(GenerateDBAction.class).buildMenu()); toolMenu.add(getAction(MigrateAction.class).buildMenu()); /** * Menu for opening Log console */ toolMenu.addSeparator(); logMenu = getAction(ShowLogConsoleAction.class).buildCheckBoxMenu(); if (!LogConsole.getInstance().getConsoleProperty(LogConsole.DOCKED_PROPERTY) && LogConsole.getInstance().getConsoleProperty(LogConsole.SHOW_CONSOLE_PROPERTY)) { LogConsole.getInstance().setConsoleProperty(LogConsole.SHOW_CONSOLE_PROPERTY, false); } updateLogConsoleMenu(); toolMenu.add(logMenu); toolMenu.addSeparator(); toolMenu.add(getAction(ConfigurePreferencesAction.class).buildMenu()); helpMenu.add(getAction(AboutAction.class).buildMenu()); helpMenu.add(getAction(DocumentationAction.class).buildMenu()); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(projectMenu); menuBar.add(toolMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); }
From source file:org.apache.jackrabbit.oak.explorer.Explorer.java
private void createAndShowGUI(final File path, boolean skipSizeCheck) throws IOException { JTextArea log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setLineWrap(true);/* ww w . jav a2s. c om*/ log.setEditable(false); final NodeStoreTree treePanel = new NodeStoreTree(backend, log, skipSizeCheck); final JFrame frame = new JFrame("Explore " + path + " @head"); frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { IOUtils.closeQuietly(treePanel); System.exit(0); } }); JPanel content = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(treePanel), new JScrollPane(log)); splitPane.setDividerLocation(0.3); content.add(new JScrollPane(splitPane), c); frame.getContentPane().add(content); JMenuBar menuBar = new JMenuBar(); menuBar.setMargin(new Insets(2, 2, 2, 2)); JMenuItem menuReopen = new JMenuItem("Reopen"); menuReopen.setMnemonic(KeyEvent.VK_R); menuReopen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { try { treePanel.reopen(); } catch (IOException e) { throw new RuntimeException(e); } } }); JMenuItem menuCompaction = new JMenuItem("Time Machine"); menuCompaction.setMnemonic(KeyEvent.VK_T); menuCompaction.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> revs = backend.readRevisions(); String s = (String) JOptionPane.showInputDialog(frame, "Revert to a specified revision", "Time Machine", JOptionPane.PLAIN_MESSAGE, null, revs.toArray(), revs.get(0)); if (s != null && treePanel.revert(s)) { frame.setTitle("Explore " + path + " @" + s); } } }); JMenuItem menuRefs = new JMenuItem("Tar File Info"); menuRefs.setMnemonic(KeyEvent.VK_I); menuRefs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> tarFiles = new ArrayList<String>(); for (File f : path.listFiles()) { if (f.getName().endsWith(".tar")) { tarFiles.add(f.getName()); } } String s = (String) JOptionPane.showInputDialog(frame, "Choose a tar file", "Tar File Info", JOptionPane.PLAIN_MESSAGE, null, tarFiles.toArray(), tarFiles.get(0)); if (s != null) { treePanel.printTarInfo(s); } } }); JMenuItem menuSCR = new JMenuItem("Segment Refs"); menuSCR.setMnemonic(KeyEvent.VK_R); menuSCR.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "Segment References\nUsage: <segmentId>", "Segment References", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printSegmentReferences(s); } } }); JMenuItem menuDiff = new JMenuItem("SegmentNodeState diff"); menuDiff.setMnemonic(KeyEvent.VK_D); menuDiff.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "SegmentNodeState diff\nUsage: <recordId> <recordId> [<path>]", "SegmentNodeState diff", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printDiff(s); } } }); JMenuItem menuPCM = new JMenuItem("Persisted Compaction Maps"); menuPCM.setMnemonic(KeyEvent.VK_P); menuPCM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { treePanel.printPCMInfo(); } }); menuBar.add(menuReopen); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuCompaction); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuRefs); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuSCR); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuDiff); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuPCM); menuBar.add(new JSeparator(JSeparator.VERTICAL)); frame.setJMenuBar(menuBar); frame.pack(); frame.setSize(960, 720); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:DragPictureDemo2.java
public JMenuBar createMenuBar() { JMenuItem menuItem = null;//from w w w . j av a2 s . c om JMenuBar menuBar = new JMenuBar(); JMenu mainMenu = new JMenu("Edit"); mainMenu.setMnemonic(KeyEvent.VK_E); TransferActionListener actionListener = new TransferActionListener(); menuItem = new JMenuItem("Cut"); menuItem.setActionCommand((String) TransferHandler.getCutAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_T); mainMenu.add(menuItem); menuItem = new JMenuItem("Copy"); menuItem.setActionCommand((String) TransferHandler.getCopyAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_C); mainMenu.add(menuItem); menuItem = new JMenuItem("Paste"); menuItem.setActionCommand((String) TransferHandler.getPasteAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_P); mainMenu.add(menuItem); menuBar.add(mainMenu); return menuBar; }
From source file:org.apache.tika.gui.TikaGUI.java
private void addMenuBar() { JMenuBar bar = new JMenuBar(); JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); addMenuItem(file, "Open...", "openfile", KeyEvent.VK_O); addMenuItem(file, "Open URL...", "openurl", KeyEvent.VK_U); file.addSeparator();/* w w w. j a va 2 s.co m*/ addMenuItem(file, "Exit", "exit", KeyEvent.VK_X); bar.add(file); JMenu view = new JMenu("View"); view.setMnemonic(KeyEvent.VK_V); addMenuItem(view, "Metadata", "metadata", KeyEvent.VK_M); addMenuItem(view, "Formatted text", "html", KeyEvent.VK_F); addMenuItem(view, "Plain text", "text", KeyEvent.VK_P); addMenuItem(view, "Main content", "main", KeyEvent.VK_C); addMenuItem(view, "Structured text", "xhtml", KeyEvent.VK_S); addMenuItem(view, "Recursive JSON", "json", KeyEvent.VK_J); bar.add(view); bar.add(Box.createHorizontalGlue()); JMenu help = new JMenu("Help"); help.setMnemonic(KeyEvent.VK_H); addMenuItem(help, "About Tika", "about", KeyEvent.VK_A); bar.add(help); setJMenuBar(bar); }
From source file:com.adobe.aem.demo.gui.AemDemo.java
@SuppressWarnings({ "rawtypes", "unchecked" }) private void initialize() { // Initialize properties setDefaultProperties(AemDemoUtils//from w w w .j a v a 2s . co m .loadProperties(buildFile.getParentFile().getAbsolutePath() + File.separator + "build.properties")); setPersonalProperties(AemDemoUtils.loadProperties(buildFile.getParentFile().getAbsolutePath() + File.separator + "conf" + File.separator + "build-personal.properties")); // Constructing the main frame frameMain = new JFrame(); frameMain.setBounds(100, 100, 700, 530); frameMain.getContentPane().setLayout(null); // Main menu bar for the Frame JMenuBar menuBar = new JMenuBar(); JMenu mnAbout = new JMenu("AEM Demo Machine"); mnAbout.setMnemonic(KeyEvent.VK_A); menuBar.add(mnAbout); JMenuItem mntmDoc = new JMenuItem("Help and Documentation"); mntmDoc.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_H, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmDoc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties, AemDemoConstants.OPTIONS_DOCUMENTATION)); } }); mnAbout.add(mntmDoc); JMenuItem mntmQuit = new JMenuItem("Quit"); mntmQuit.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(-1); } }); mnAbout.add(mntmQuit); JMenu mnNew = new JMenu("New"); mnNew.setMnemonic(KeyEvent.VK_N); menuBar.add(mnNew); // New Demo Machine JMenuItem mntmNewDemo = new JMenuItem("Demo Environment"); mntmNewDemo.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmNewDemo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (AemDemo.this.getBuildInProgress()) { JOptionPane.showMessageDialog(null, "A Demo Environment is currently being built. Please wait until it is finished."); } else { final AemDemoNew dialogNew = new AemDemoNew(AemDemo.this); dialogNew.setModal(true); dialogNew.setVisible(true); dialogNew.getDemoBuildName().requestFocus(); ; } } }); mnNew.add(mntmNewDemo); JMenuItem mntmNewOptions = new JMenuItem("Demo Properties"); mntmNewOptions.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmNewOptions.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final AemDemoOptions dialogOptions = new AemDemoOptions(AemDemo.this); dialogOptions.setModal(true); dialogOptions.setVisible(true); } }); mnNew.add(mntmNewOptions); JMenu mnUpdate = new JMenu("Add-ons"); menuBar.add(mnUpdate); // Sites Add-on JMenu mnSites = new JMenu("Sites"); mnUpdate.add(mnSites); JMenuItem mntmSitesDownloadAddOn = new JMenuItem("Download Add-On"); mntmSitesDownloadAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_sites"); } }); mnSites.add(mntmSitesDownloadAddOn); JMenuItem mntmSitesDownloadFP = new JMenuItem("Download Feature Pack (VPN)"); mntmSitesDownloadFP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_sites_fp"); } }); mnSites.add(mntmSitesDownloadFP); mnSites.addSeparator(); JMenuItem mntmSitesInstallAddOn = new JMenuItem("Install Add-on"); mntmSitesInstallAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "sites"); } }); mnSites.add(mntmSitesInstallAddOn); // Assets Add-on JMenu mnAssets = new JMenu("Assets"); mnUpdate.add(mnAssets); JMenuItem mntmAssetsDownloadAddOn = new JMenuItem("Download Add-on"); mntmAssetsDownloadAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_assets"); } }); mnAssets.add(mntmAssetsDownloadAddOn); mnAssets.addSeparator(); JMenuItem mntmAssetsInstallAddOn = new JMenuItem("Install Add-on"); mntmAssetsInstallAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "assets"); } }); mnAssets.add(mntmAssetsInstallAddOn); // Communities Add-on JMenu mnCommunities = new JMenu("Communities"); mnUpdate.add(mnCommunities); JMenuItem mntmAemCommunitiesUber = new JMenuItem("Download Latest Bundles (VPN)"); mntmAemCommunitiesUber.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmAemCommunitiesUber.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_communities_bundles"); } }); mnCommunities.add(mntmAemCommunitiesUber); JMenuItem mntmAemCommunitiesFeaturePacks = new JMenuItem("Download Latest Feature Packs (PackageShare)"); mntmAemCommunitiesFeaturePacks.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_communities_fp"); } }); mnCommunities.add(mntmAemCommunitiesFeaturePacks); JMenuItem mntmAemCommunitiesEnablement = new JMenuItem("Download Enablement Demo Site Add-on (4.5GB)"); mntmAemCommunitiesEnablement.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_enablement"); } }); mnCommunities.add(mntmAemCommunitiesEnablement); mnCommunities.addSeparator(); JMenuItem mntmAemCommunitiesAddOn = new JMenuItem("Install Add-on"); mntmAemCommunitiesAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "communities"); } }); mnCommunities.add(mntmAemCommunitiesAddOn); // Forms Add-on JMenu mnForms = new JMenu("Forms"); mnUpdate.add(mnForms); JMenuItem mntmAemFormsFP = new JMenuItem("Download Demo Add-on (PackageShare)"); mntmAemFormsFP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_forms_fp"); } }); mnForms.add(mntmAemFormsFP); mnForms.addSeparator(); JMenuItem mntmAemFormsAddOn = new JMenuItem("Install Add-on"); mntmAemFormsAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "forms"); } }); mnForms.add(mntmAemFormsAddOn); // Apps Add-on JMenu mnApps = new JMenu("Apps"); mnUpdate.add(mnApps); JMenuItem mntmAemApps = new JMenuItem("Download Add-on"); mntmAemApps.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_apps"); } }); mnApps.add(mntmAemApps); mnApps.addSeparator(); JMenuItem mntmAemAppsAddOn = new JMenuItem("Install Add-on"); mntmAemAppsAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "apps"); } }); mnApps.add(mntmAemAppsAddOn); // Commerce Add-on JMenu mnCommerce = new JMenu("Commerce"); mnUpdate.add(mnCommerce); JMenu mnCommerceDownload = new JMenu("Download Add-on"); mnCommerce.add(mnCommerceDownload); // Commerce EP JMenuItem mnCommerceDownloadEP = new JMenuItem("ElasticPath"); mnCommerceDownloadEP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_commerce_ep"); } }); mnCommerceDownload.add(mnCommerceDownloadEP); // Commerce WebSphere JMenuItem mnCommerceDownloadWAS = new JMenuItem("WebSphere"); mnCommerceDownloadWAS.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_commerce_websphere"); } }); mnCommerceDownload.add(mnCommerceDownloadWAS); mnCommerce.addSeparator(); JMenuItem mntmAemCommerceAddOn = new JMenuItem("Install Add-on"); mntmAemCommerceAddOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "commerce"); } }); mnCommerce.add(mntmAemCommerceAddOn); mnUpdate.addSeparator(); JMenuItem mntmAemDownloadAll = new JMenuItem("Download All Add-ons"); mntmAemDownloadAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_all"); } }); mnUpdate.add(mntmAemDownloadAll); JMenuItem mntmAemDownloadFromDrive = new JMenuItem("Download Web Page"); mntmAemDownloadFromDrive.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties, AemDemoConstants.OPTIONS_WEBDOWNLOAD)); } }); mnUpdate.add(mntmAemDownloadFromDrive); JMenu mnInfrastructure = new JMenu("Infrastructure"); menuBar.add(mnInfrastructure); JMenu mnMongo = new JMenu("MongoDB"); JMenuItem mntmInfraMongoDB = new JMenuItem("Download"); mntmInfraMongoDB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_mongo"); } }); mnMongo.add(mntmInfraMongoDB); JMenuItem mntmInfraMongoDBInstall = new JMenuItem("Install"); mntmInfraMongoDBInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_mongo"); } }); mnMongo.add(mntmInfraMongoDBInstall); mnMongo.addSeparator(); JMenuItem mntmInfraMongoDBStart = new JMenuItem("Start"); mntmInfraMongoDBStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mongo_start"); } }); mnMongo.add(mntmInfraMongoDBStart); JMenuItem mntmInfraMongoDBStop = new JMenuItem("Stop"); mntmInfraMongoDBStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mongo_stop"); } }); mnMongo.add(mntmInfraMongoDBStop); mnInfrastructure.add(mnMongo); // SOLR options JMenu mnSOLR = new JMenu("SOLR"); JMenuItem mntmInfraSOLR = new JMenuItem("Download"); mntmInfraSOLR.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_solr"); } }); mnSOLR.add(mntmInfraSOLR); JMenuItem mntmInfraSOLRInstall = new JMenuItem("Install"); mntmInfraSOLRInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_solr"); } }); mnSOLR.add(mntmInfraSOLRInstall); mnSOLR.addSeparator(); JMenuItem mntmInfraSOLRStart = new JMenuItem("Start"); mntmInfraSOLRStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "solr_start"); } }); mnSOLR.add(mntmInfraSOLRStart); JMenuItem mntmInfraSOLRStop = new JMenuItem("Stop"); mntmInfraSOLRStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "solr_stop"); } }); mnSOLR.add(mntmInfraSOLRStop); mnInfrastructure.add(mnSOLR); // MySQL options JMenu mnMySQL = new JMenu("MySQL"); JMenuItem mntmInfraMysql = new JMenuItem("Download"); mntmInfraMysql.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_mysql"); } }); mnMySQL.add(mntmInfraMysql); JMenuItem mntmInfraMysqlInstall = new JMenuItem("Install"); mntmInfraMysqlInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_mysql"); } }); mnMySQL.add(mntmInfraMysqlInstall); mnMySQL.addSeparator(); JMenuItem mntmInfraMysqlStart = new JMenuItem("Start"); mntmInfraMysqlStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mysql_start"); } }); mnMySQL.add(mntmInfraMysqlStart); JMenuItem mntmInfraMysqlStop = new JMenuItem("Stop"); mntmInfraMysqlStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "mysql_stop"); } }); mnMySQL.add(mntmInfraMysqlStop); mnInfrastructure.add(mnMySQL); // FFMPEPG options JMenu mnFFMPEG = new JMenu("FFMPEG"); JMenuItem mntmInfraFFMPEG = new JMenuItem("Download"); mntmInfraFFMPEG.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_ffmpeg"); } }); mnFFMPEG.add(mntmInfraFFMPEG); JMenuItem mntmInfraFFMPEGInstall = new JMenuItem("Install"); mntmInfraFFMPEGInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "install_ffmpeg"); } }); mnFFMPEG.add(mntmInfraFFMPEGInstall); mnInfrastructure.add(mnFFMPEG); // Apache James options JMenu mnJames = new JMenu("James SMTP"); JMenuItem mnJamesStart = new JMenuItem("Start"); mnJamesStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "james_start"); } }); mnJames.add(mnJamesStart); JMenuItem mnJamesStop = new JMenuItem("Stop"); mnJamesStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "james_stop"); } }); mnJames.add(mnJamesStop); mnInfrastructure.add(mnJames); mnInfrastructure.addSeparator(); JMenuItem mntmInfraInstall = new JMenuItem("All in One Setup"); mntmInfraInstall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "infrastructure"); } }); mnInfrastructure.add(mntmInfraInstall); JMenu mnOther = new JMenu("Other"); menuBar.add(mnOther); JMenu mntmAemDownload = new JMenu("AEM & License files (VPN)"); JMenuItem mntmAemDownloadAEM61 = new JMenuItem("Download AEM 6.1"); mntmAemDownloadAEM61.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_aem61"); } }); mntmAemDownload.add(mntmAemDownloadAEM61); JMenuItem mntmAemDownloadAEM60 = new JMenuItem("Download AEM 6.0"); mntmAemDownloadAEM60.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_aem60"); } }); mntmAemDownload.add(mntmAemDownloadAEM60); JMenuItem mntmAemDownloadCQ561 = new JMenuItem("Download CQ 5.6.1"); mntmAemDownloadCQ561.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_cq561"); } }); mntmAemDownload.add(mntmAemDownloadCQ561); JMenuItem mntmAemDownloadCQ56 = new JMenuItem("Download CQ 5.6"); mntmAemDownloadCQ56.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_cq56"); } }); mntmAemDownload.add(mntmAemDownloadCQ56); JMenuItem mntmAemDownloadOthers = new JMenuItem("Other Releases & License files"); mntmAemDownloadOthers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties, AemDemoConstants.OPTIONS_DOWNLOAD)); } }); mntmAemDownload.add(mntmAemDownloadOthers); mnOther.add(mntmAemDownload); JMenuItem mntmAemSnapshot = new JMenuItem("Download Latest AEM Snapshot (VPN)"); mntmAemSnapshot.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmAemSnapshot.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "download_snapshot"); } }); mnOther.add(mntmAemSnapshot); JMenuItem mntmAemDemoMachine = new JMenuItem("Download Latest AEM Demo Machine"); mntmAemDemoMachine.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mntmAemDemoMachine.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties, AemDemoConstants.OPTIONS_DEMODOWNLOAD)); } }); mnOther.add(mntmAemDemoMachine); // Adding the menu bar frameMain.setJMenuBar(menuBar); // Adding other form elements JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(24, 184, 650, 230); frameMain.getContentPane().add(scrollPane); final JTextArea textArea = new JTextArea(""); textArea.setEditable(false); scrollPane.setViewportView(textArea); // List of demo machines available JScrollPane scrollDemoList = new JScrollPane(); scrollDemoList.setBounds(24, 55, 208, 100); frameMain.getContentPane().add(scrollDemoList); listModelDemoMachines = AemDemoUtils.listDemoMachines(buildFile.getParentFile().getAbsolutePath()); listDemoMachines = new JList(listModelDemoMachines); scrollDemoList.setViewportView(listDemoMachines); // Capturing the output stream of ANT commands AemDemoOutputStream out = new AemDemoOutputStream(textArea); System.setOut(new PrintStream(out)); JButton btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "start"); } }); btnStart.setBounds(250, 50, 117, 29); frameMain.getContentPane().add(btnStart); // Set Start as the default button JRootPane rootPane = SwingUtilities.getRootPane(btnStart); rootPane.setDefaultButton(btnStart); JButton btnInfo = new JButton("Details"); btnInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "version"); AemDemoUtils.antTarget(AemDemo.this, "configuration"); } }); btnInfo.setBounds(250, 80, 117, 29); frameMain.getContentPane().add(btnInfo); JButton btnStop = new JButton("Stop"); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "stop"); } }); btnStop.setBounds(500, 50, 117, 29); frameMain.getContentPane().add(btnStop); JButton btnExit = new JButton("Exit"); btnExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(-1); } }); btnExit.setBounds(550, 429, 117, 29); frameMain.getContentPane().add(btnExit); JButton btnClear = new JButton("Clear"); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textArea.setText(""); } }); btnClear.setBounds(40, 429, 117, 29); frameMain.getContentPane().add(btnClear); JButton btnBackup = new JButton("Backup"); btnBackup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "backup"); } }); btnBackup.setBounds(500, 80, 117, 29); frameMain.getContentPane().add(btnBackup); JButton btnRestore = new JButton("Restore"); btnRestore.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "restore"); } }); btnRestore.setBounds(500, 110, 117, 29); frameMain.getContentPane().add(btnRestore); JButton btnDelete = new JButton("Delete"); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AemDemoUtils.antTarget(AemDemo.this, "uninstall"); } }); btnDelete.setBounds(500, 140, 117, 29); frameMain.getContentPane().add(btnDelete); JLabel lblSelectYourDemo = new JLabel("Select your Demo Environment"); lblSelectYourDemo.setBounds(24, 31, 219, 16); frameMain.getContentPane().add(lblSelectYourDemo); JLabel lblCommandOutput = new JLabel("Command Output"); lblCommandOutput.setBounds(24, 164, 160, 16); frameMain.getContentPane().add(lblCommandOutput); // Launching the download tracker task AemDemoDownload aemDownload = new AemDemoDownload(AemDemo.this); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); executor.scheduleAtFixedRate(aemDownload, 0, 5, TimeUnit.SECONDS); }
From source file:org.lnicholls.galleon.gui.MainFrame.java
public MainFrame(String version) { super("Galleon " + version); setDefaultCloseOperation(0);/*from www . jav a 2 s .c om*/ JMenuBar menuBar = new JMenuBar(); menuBar.putClientProperty("jgoodies.headerStyle", HeaderStyle.BOTH); menuBar.putClientProperty("jgoodies.windows.borderStyle", BorderStyle.SEPARATOR); menuBar.putClientProperty("Plastic.borderStyle", BorderStyle.SEPARATOR); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('F'); fileMenu.add(new MenuAction("New App...", null, "", new Integer(KeyEvent.VK_N)) { public void actionPerformed(ActionEvent event) { new AddAppDialog(Galleon.getMainFrame()).setVisible(true); } }); fileMenu.addSeparator(); fileMenu.add(new MenuAction("Properties...", null, "", new Integer(KeyEvent.VK_P)) { public void actionPerformed(ActionEvent event) { new ServerDialog(Galleon.getMainFrame(), Galleon.getServerConfiguration()).setVisible(true); } }); /* fileMenu.add(new MenuAction("Galleon.tv Account...", null, "", new Integer(KeyEvent.VK_A)) { public void actionPerformed(ActionEvent event) { new DataDialog(Galleon.getMainFrame(), Galleon.getServerConfiguration()).setVisible(true); } }); */ fileMenu.add(new MenuAction("Download Manager...", null, "", new Integer(KeyEvent.VK_D)) { public void actionPerformed(ActionEvent event) { new DownloadManagerDialog(Galleon.getMainFrame(), Galleon.getServerConfiguration()) .setVisible(true); } }); fileMenu.add(new MenuAction("GoBack...", null, "", new Integer(KeyEvent.VK_G)) { public void actionPerformed(ActionEvent event) { new GoBackDialog(Galleon.getMainFrame(), Galleon.getServerConfiguration()).setVisible(true); } }); fileMenu.add(new MenuAction("Music Player...", null, "", new Integer(KeyEvent.VK_M)) { public void actionPerformed(ActionEvent event) { new MusicPlayerDialog(Galleon.getMainFrame(), Galleon.getServerConfiguration()).setVisible(true); } }); fileMenu.add(new MenuAction("ToGo...", null, "", new Integer(KeyEvent.VK_T)) { public void actionPerformed(ActionEvent event) { new ToGoDialog(Galleon.getMainFrame(), Galleon.getServerConfiguration()).setVisible(true); } }); fileMenu.addSeparator(); fileMenu.add(new MenuAction("Exit", null, "", new Integer(KeyEvent.VK_X)) { public void actionPerformed(ActionEvent event) { System.exit(0); } }); menuBar.add(fileMenu); JMenu tutorialMenu = new JMenu("Tutorials"); tutorialMenu.setMnemonic('T'); tutorialMenu.putClientProperty("jgoodies.noIcons", Boolean.TRUE); tutorialMenu.add(new MenuAction("Properties", null, "", new Integer(KeyEvent.VK_P)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/view/88/48/"); } catch (Exception ex) { } } }); tutorialMenu.add(new MenuAction("Music Player", null, "", new Integer(KeyEvent.VK_M)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/view/88/48/"); } catch (Exception ex) { } } }); tutorialMenu.addSeparator(); tutorialMenu.add(new MenuAction("Email", null, "", new Integer(KeyEvent.VK_E)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/view/88/48/"); } catch (Exception ex) { } } }); tutorialMenu.add(new MenuAction("Music", null, "", new Integer(KeyEvent.VK_U)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/view/88/48/"); } catch (Exception ex) { } } }); tutorialMenu.add(new MenuAction("Podcasting", null, "", new Integer(KeyEvent.VK_O)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/view/88/48/"); } catch (Exception ex) { } } }); tutorialMenu.add(new MenuAction("ToGo", null, "", new Integer(KeyEvent.VK_T)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/view/88/48/"); } catch (Exception ex) { } } }); menuBar.add(tutorialMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('H'); helpMenu.putClientProperty("jgoodies.noIcons", Boolean.TRUE); helpMenu.add(new MenuAction("Homepage", null, "", new Integer(KeyEvent.VK_H)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv"); } catch (Exception ex) { } } }); helpMenu.add(new MenuAction("Configuration", null, "", new Integer(KeyEvent.VK_C)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/view/93/52/"); } catch (Exception ex) { } } }); helpMenu.add(new MenuAction("FAQ", null, "", new Integer(KeyEvent.VK_F)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/content/section/3/47/"); } catch (Exception ex) { } } }); /* helpMenu.add(new MenuAction("TiVo Community Forum", null, "", new Integer(KeyEvent.VK_T)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://www.tivocommunity.com/tivo-vb/forumdisplay.php?f=35"); } catch (Exception ex) { } } }); */ helpMenu.add(new MenuAction("Galleon Forum", null, "", new Integer(KeyEvent.VK_G)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher.openURL("http://galleon.tv/component/option,com_joomlaboard/Itemid,26/"); } catch (Exception ex) { } } }); helpMenu.add(new MenuAction("File a bug", null, "", new Integer(KeyEvent.VK_B)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher .openURL("http://sourceforge.net/tracker/?atid=705256&group_id=126291&func=browse"); } catch (Exception ex) { } } }); helpMenu.add(new MenuAction("Request a feature", null, "", new Integer(KeyEvent.VK_E)) { public void actionPerformed(ActionEvent event) { try { BrowserLauncher .openURL("http://sourceforge.net/tracker/?atid=705259&group_id=126291&func=browse"); } catch (Exception ex) { } } }); helpMenu.addSeparator(); helpMenu.add(new MenuAction("About...", null, "", new Integer(KeyEvent.VK_A)) { public void actionPerformed(ActionEvent event) { JOptionPane .showMessageDialog( Galleon.getMainFrame(), "Galleon Version " + Tools.getVersion() + "\nJava Version " + System.getProperty("java.vm.version") + "\nPublishing Port " + Galleon.getHttpPort() + "\nApplication Port " + Galleon.getPort() + "\nhttp://galleon.tv\njavahmo@users.sourceforge.net\nCopyright \251 2005, 2006 Leon Nicholls. All Rights Reserved.", "About", JOptionPane.INFORMATION_MESSAGE); } }); menuBar.add(helpMenu); setJMenuBar(menuBar); JComponent content = createContentPane(); setContentPane(content); pack(); Dimension paneSize = getSize(); Dimension screenSize = getToolkit().getScreenSize(); setLocation((screenSize.width - paneSize.width) / 2, (screenSize.height - paneSize.height) / 2); URL url = getClass().getClassLoader().getResource("guiicon.gif"); ImageIcon logo = new ImageIcon(url); if (logo != null) setIconImage(logo.getImage()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); }
From source file:org.rimudb.editor.RimuDBEditor.java
public JMenuBar buildJMenuBar() { log.debug("buildJMenuBar()"); JMenuBar menuBar = new JMenuBar(); // File menu/*from w ww . j a v a2 s.c om*/ JMenu menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); openMenuItem = new JMenuItem( new OpenDescriptorAction(this, "Open...", loadIcon("/images/famfamfam/folder.png"))); openMenuItem.setName("OpenMenuItem"); openMenuItem.setMnemonic(KeyEvent.VK_O); openMenuItem.setAccelerator( KeyStroke.getKeyStroke('O', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); menu.add(openMenuItem); saveMenuItem = new JMenuItem( new SaveDescriptorAction(this, "Save", loadIcon("/images/famfamfam/disk.png"))); saveMenuItem.setName("SaveMenuItem"); saveMenuItem.setMnemonic(KeyEvent.VK_S); saveMenuItem.setAccelerator( KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); menu.add(saveMenuItem); saveAsMenuItem = new JMenuItem(new SaveAsDescriptorAction(this, "Save as...")); saveAsMenuItem.setName("SaveAsMenuItem"); menu.add(saveAsMenuItem); menu.addSeparator(); clearMenuItem = new JMenuItem( new ClearTableAction(this, "Clear...", loadIcon("/images/famfamfam/bin_closed.png"))); clearMenuItem.setName("ClearMenuItem"); clearMenuItem.setMnemonic(KeyEvent.VK_C); menu.add(clearMenuItem); preferencesMenuItem = new JMenuItem( new PreferencesAction(this, "Preferences...", loadIcon("/images/famfamfam/text_list_bullets.png"))); preferencesMenuItem.setName("PreferencesMenuItem"); preferencesMenuItem.setEnabled(false); preferencesMenuItem.setMnemonic(KeyEvent.VK_P); menu.add(preferencesMenuItem); menu.addSeparator(); exitMenuItem = new JMenuItem(new ExitAction(this, "Exit")); exitMenuItem.setName("ExitMenuItem"); exitMenuItem.setMnemonic(KeyEvent.VK_E); menu.add(exitMenuItem); menuBar.add(menu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic(KeyEvent.VK_T); dbImportMenuItem = new JMenuItem( new ImportAction(this, "Import from database...", loadIcon("/images/famfamfam/database_go.png"))); dbImportMenuItem.setName("DbImportMenuItem"); dbImportMenuItem.setEnabled(false); dbImportMenuItem.setMnemonic(KeyEvent.VK_I); dbImportMenuItem.setAccelerator( KeyStroke.getKeyStroke('I', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); toolsMenu.add(dbImportMenuItem); createClassesMenuItem = new JMenuItem(new GenerateJavaAction(this, "Create classes...", loadIcon("/images/famfamfam/page_white_cup.png"))); createClassesMenuItem.setName("CreateClassesMenuItem"); createClassesMenuItem.setMnemonic(KeyEvent.VK_C); toolsMenu.add(createClassesMenuItem); ddsExportMenuItem = new JMenuItem("Export as DDS..."); ddsExportMenuItem.setName("DdsExportMenuItem"); ddsExportMenuItem.setMnemonic(KeyEvent.VK_D); ddsExportMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { actionExportToDDS(); } }); toolsMenu.add(ddsExportMenuItem); sqlExportMenuItem = new JMenuItem("Export as SQL..."); sqlExportMenuItem.setIcon(loadIcon("/images/famfamfam/page_white_database.png")); sqlExportMenuItem.setName("SqlExportMenuItem"); sqlExportMenuItem.setMnemonic(KeyEvent.VK_Q); sqlExportMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { actionExportToSQL(); } }); toolsMenu.add(sqlExportMenuItem); toolsMenu.addSeparator(); propertyRenameMenuItem = new JMenuItem("Rename Properties..."); propertyRenameMenuItem.setName("PropertyRenameMenuItem"); propertyRenameMenuItem.setMnemonic(KeyEvent.VK_R); propertyRenameMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { actionRenameProperties(); } }); toolsMenu.add(propertyRenameMenuItem); copyCodeMenuItem = new JMenuItem(new GenerateCopyCodeAction(this, "Create Java DO Copy Code...", null)); copyCodeMenuItem.setName("CopyCodeMenuItem"); toolsMenu.add(copyCodeMenuItem); convertFinderMenuItem = new JMenuItem(new ConvertFinderAction(this, "Convert Finders (pre 1.1)...", null)); convertFinderMenuItem.setName("ConvertFinderMenuItem"); toolsMenu.add(convertFinderMenuItem); convertCDBMenuItem = new JMenuItem(new ConvertCDBAction(this, "Convert CDB Configs (pre 1.2)...", null)); convertCDBMenuItem.setName("ConvertCDBMenuItem"); toolsMenu.add(convertCDBMenuItem); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic(KeyEvent.VK_H); aboutMenuItem = new JMenuItem(new AboutAction(this, "About...")); aboutMenuItem.setName("AboutMenuItem"); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); return menuBar; }
From source file:com.AandR.beans.plotting.imagePlotPanel.CanvasPanel.java
private void createPopupMenu() { popupMenu = new JPopupMenu(); popupMenu.add(createPopupMenuItem("Toggle Log Plot", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 0))); popupMenu.add(createPopupMenuItem("Slice Here", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 10))); popupMenu.addSeparator();//from w ww . j a v a2 s . c om JMenu navigateMenu = new JMenu("Navigate"); navigateMenu.add(createPopupMenuItem("View First Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_F, 2))); navigateMenu .add(createPopupMenuItem("View Previous Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_P, 2))); navigateMenu .add(createPopupMenuItem("Choose Frame To View", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 2))); navigateMenu.add(createPopupMenuItem("View Next Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_N, 2))); navigateMenu.add(createPopupMenuItem("View Last Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 2))); popupMenu.add(navigateMenu); popupMenu.addSeparator(); popupMenu.add(createPopupMenuItem("Set Zoom Level", null, KeyStroke.getKeyStroke(KeyEvent.VK_Z, 2))); popupMenu.add(createPopupMenuItem("Set Min/Max", null, KeyStroke.getKeyStroke(KeyEvent.VK_R, 2))); popupMenu.add(createPopupMenuItem("Set Physical Extent", null, KeyStroke.getKeyStroke(KeyEvent.VK_E, 2))); popupMenu.addSeparator(); popupMenu.add(createPopupMenuItem("Recenter on Viewport", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 0))); popupMenu.addSeparator(); popupMenu.add(createPopupMenuItem("Set Colormap", null, KeyStroke.getKeyStroke(KeyEvent.VK_M, 2))); popupMenu.addSeparator(); JMenu overlayMenu = new JMenu("Overlays"); overlayMenu.add(createPopupMenuItem("Add Text Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_T, 2))); overlayMenu.add(createPopupMenuItem("Add Shape Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_O, 2))); overlayMenu.add(createPopupMenuItem("Add Annulus Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_U, 2))); overlayMenu.add(createPopupMenuItem("Add Arrow Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_A, 2))); popupMenu.add(overlayMenu); popupMenu.addSeparator(); JMenu pngMenu = new JMenu("To PNG"); pngMenu.add(createPopupMenuItem("Export Original Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 10))); pngMenu.add(createPopupMenuItem("Export Viewport Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 2))); pngMenu.addSeparator(); pngMenu.add(createPopupMenuItem("Export Viewport Series", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 8))); JMenu pdfMenu = new JMenu("To PDF"); pdfMenu.add(createPopupMenuItem("Export Original Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.SHIFT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK))); pdfMenu.add(createPopupMenuItem("Export Viewport Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.ALT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK))); JMenu exportMenu = new JMenu("Export"); exportMenu.add(pngMenu); exportMenu.add(pdfMenu); popupMenu.add(exportMenu); popupMenu.addSeparator(); JMenu losslessMenu = new JMenu("Lossless Modifications"); losslessMenu.add(createPopupMenuItem("Flip Horizontally", null, KeyStroke.getKeyStroke(KeyEvent.VK_H, 10))); losslessMenu.add(createPopupMenuItem("Flip Vertically", null, KeyStroke.getKeyStroke(KeyEvent.VK_V, 10))); losslessMenu.addSeparator(); losslessMenu.add(createPopupMenuItem("Rotate +90", null, KeyStroke.getKeyStroke(KeyEvent.VK_R, 10))); losslessMenu.add(createPopupMenuItem("Rotate -90", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 10))); popupMenu.add(losslessMenu); }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementsmanager.view.charts.StatView.java
/** * Builds the side panel with all the options for this StatViw * //from w ww. j a va 2 s. c o m * @return the formatted side panel */ public JPanel buildSidePanel() { final int VERTICAL_PADDING = 5; final int HORIZONTAL_PADDING = 5; final int FAR = 5; final SpringLayout sidePanelLayout = new SpringLayout(); final JPanel sidePanel = new JPanel(sidePanelLayout); final JLabel lblStatisticType = new JLabel("Statistic Type"); final String[] availableStatisticTypes = { "Status", "Assignees", "Iterations", "Velocity" }; // TODO: Add Estimates, Effort, Tasks charts for future use. comboBoxStatisticType = new JComboBox(availableStatisticTypes); comboBoxStatisticType.addActionListener(this); makePieRadio = new JRadioButton("Pie Chart"); makePieRadio.setMnemonic(KeyEvent.VK_P); makePieRadio.setActionCommand("Pie Chart"); makePieRadio.addActionListener(this); makeBarRadio = new JRadioButton("Bar Chart"); makeBarRadio.setMnemonic(KeyEvent.VK_B); makeBarRadio.setActionCommand("Bar Chart"); makeBarRadio.addActionListener(this); makeLineRadio = new JRadioButton("Line Chart"); makeLineRadio.setMnemonic(KeyEvent.VK_B); makeLineRadio.setActionCommand("Line Chart"); makeLineRadio.addActionListener(this); makeLineRadio.setEnabled(false); final ButtonGroup group = new ButtonGroup(); group.add(makePieRadio); group.add(makeBarRadio); group.add(makeLineRadio); updateSelectedItems(); final JPanel radioPanel = new JPanel(new GridLayout(3, 1)); radioPanel.add(makePieRadio); radioPanel.add(makeBarRadio); radioPanel.add(makeLineRadio); radioPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Chart Type")); sidePanel.add(lblStatisticType); sidePanel.add(comboBoxStatisticType); sidePanel.add(radioPanel); sidePanelLayout.putConstraint(SpringLayout.NORTH, lblStatisticType, VERTICAL_PADDING, SpringLayout.NORTH, sidePanel); sidePanelLayout.putConstraint(SpringLayout.WEST, lblStatisticType, HORIZONTAL_PADDING, SpringLayout.WEST, sidePanel); sidePanelLayout.putConstraint(SpringLayout.NORTH, comboBoxStatisticType, VERTICAL_PADDING, SpringLayout.SOUTH, lblStatisticType); sidePanelLayout.putConstraint(SpringLayout.WEST, comboBoxStatisticType, HORIZONTAL_PADDING, SpringLayout.WEST, sidePanel); sidePanelLayout.putConstraint(SpringLayout.NORTH, radioPanel, VERTICAL_PADDING + FAR, SpringLayout.SOUTH, comboBoxStatisticType); sidePanelLayout.putConstraint(SpringLayout.WEST, radioPanel, HORIZONTAL_PADDING, SpringLayout.WEST, sidePanel); return sidePanel; }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakListChartPanel.java
protected void createActions() { theActionManager.add("mslevel=ms", FileUtils.defaultThemeManager.getImageIcon("msms"), "Change current scan level", -1, "", this); theActionManager.add("mslevel=msms", FileUtils.defaultThemeManager.getImageIcon("ms"), "Change current scan level", -1, "", this); theActionManager.add("updateisotopecurves=true", FileUtils.defaultThemeManager.getImageIcon("isotopesoff"), "Automatic computation of isotopic distributions inactive", -1, "", this); theActionManager.add("updateisotopecurves=false", FileUtils.defaultThemeManager.getImageIcon("isotopeson"), "Automatic computation of isotopic distributions active", -1, "", this); theActionManager.add("showallisotopes=true", FileUtils.defaultThemeManager.getImageIcon("ftmodeoff"), "FTICR mode inactive", -1, "", this); theActionManager.add("showallisotopes=false", FileUtils.defaultThemeManager.getImageIcon("ftmodeon"), "FTICR mode active", -1, "", this); theActionManager.add("new", FileUtils.defaultThemeManager.getImageIcon("new"), "Clear", KeyEvent.VK_N, "", this); theActionManager.add("open", FileUtils.defaultThemeManager.getImageIcon("open"), "Open...", KeyEvent.VK_O, "", this); theActionManager.add("print", FileUtils.defaultThemeManager.getImageIcon("print"), "Print...", KeyEvent.VK_P, "", this); theActionManager.add("annotatepeaks", FileUtils.defaultThemeManager.getImageIcon("annotatepeaks"), "Find possible annotations for selected peaks", -1, "", this); theActionManager.add("arrow", FileUtils.defaultThemeManager.getImageIcon("arrow"), "Activate zoom", -1, "", this); theActionManager.add("hand", FileUtils.defaultThemeManager.getImageIcon("hand"), "Activate moving", -1, "", this); theActionManager.add("zoomnone", FileUtils.defaultThemeManager.getImageIcon("zoomnone"), "Reset zoom", -1, "", this); theActionManager.add("zoomin", FileUtils.defaultThemeManager.getImageIcon("zoomin"), "Zoom in", -1, "", this); theActionManager.add("zoomout", FileUtils.defaultThemeManager.getImageIcon("zoomout"), "Zoom out", -1, "", this); }