List of usage examples for java.awt.event KeyEvent VK_I
int VK_I
To view the source code for java.awt.event KeyEvent VK_I.
Click Source Link
From source file:edu.purdue.cc.bionet.ui.CorrelationDisplayPanel.java
/** * Adds all of the necessary Components to this Component. *///from ww w . j a va 2 s . c om private void buildPanel() { Language language = Settings.getLanguage(); this.correlationMethodMenu = new JMenu(language.get("Correlation Method")); this.correlationMethodMenuButtonGroup = new ButtonGroup(); this.pearsonCalculationMenuItem = new JRadioButtonMenuItem(language.get("Pearson"), true); this.spearmanCalculationMenuItem = new JRadioButtonMenuItem(language.get("Spearman")); this.kendallCalculationMenuItem = new JRadioButtonMenuItem(language.get("Kendall")); // layout menu itmes this.layoutMenu = new JMenu(language.get("Layout")); this.layoutMenuButtonGroup = new ButtonGroup(); this.multipleCirclesLayoutMenuItem = new JRadioButtonMenuItem(language.get("Multiple Circles")); this.singleCircleLayoutMenuItem = new JRadioButtonMenuItem(language.get("Single Circle"), true); this.randomLayoutMenuItem = new JRadioButtonMenuItem(language.get("Random")); this.heatMapLayoutMenuItem = new JRadioButtonMenuItem(language.get("Heat Map")); this.kkLayoutMenuItem = new JRadioButtonMenuItem(language.get("Kamada-Kawai")); // this.frLayoutMenuItem = // new JRadioButtonMenuItem( language.get( "Fruchterman-Reingold" )); // this.springLayoutMenuItem = // new JRadioButtonMenuItem( language.get( "Spring Layout" )); this.frSpringLayoutMenuItem = new JRadioButtonMenuItem(language.get("Spring Layout")); // this.animatedLayoutMenuItem = new JCheckBoxMenuItem( // language.get( "Fruchterman-Reingold Spring Embedding" )); // view menu items this.viewMenu = new JMenu(language.get("View")); this.zoomInViewMenuItem = new JMenuItem(language.get("Zoom In"), KeyEvent.VK_I); this.zoomOutViewMenuItem = new JMenuItem(language.get("Zoom Out"), KeyEvent.VK_O); this.fitToWindowViewMenuItem = new JMenuItem(language.get("Fit to Window"), KeyEvent.VK_F); this.selectAllViewMenuItem = new JMenuItem(language.get("Select All"), KeyEvent.VK_A); this.clearSelectionViewMenuItem = new JMenuItem(language.get("Clear Selection"), KeyEvent.VK_C); this.invertSelectionViewMenuItem = new JMenuItem(language.get("Invert Selection"), KeyEvent.VK_I); this.selectCorrelatedViewMenuItem = new JMenuItem(language.get("Select Correlated to Selection"), KeyEvent.VK_R); this.hideSelectedViewMenuItem = new JMenuItem(language.get("Hide Selected"), KeyEvent.VK_H); this.hideUnselectedViewMenuItem = new JMenuItem(language.get("Hide Unselected"), KeyEvent.VK_U); this.hideUncorrelatedViewMenuItem = new JMenuItem(language.get("Hide Uncorrelated to Selection"), KeyEvent.VK_L); this.hideOrphansViewMenuItem = new JMenuItem(language.get("Hide Orphans"), KeyEvent.VK_P); this.showCorrelatedViewMenuItem = new JMenuItem(language.get("Show All Correlated to Visible"), KeyEvent.VK_S); this.saveImageAction = new SaveImageAction(language.get("Save Main Graph Image") + "...", null); // groups menu items this.groupsMenu = new JMenu(language.get("Groups")); this.resetSampleGroupsMenuItem = new JMenuItem(language.get("Reset Sample Groups"), KeyEvent.VK_R); this.chooseSampleGroupsMenuItem = new JMenuItem(language.get("Choose Sample Groups") + "...", KeyEvent.VK_C); // color menu items this.colorMenu = new JMenu(language.get("Color")); this.colorMenuButtonGroup = new ButtonGroup(); this.normalColorMenuItem = new JRadioButtonMenuItem(language.get("Normal Color"), true); this.highContrastColorMenuItem = new JRadioButtonMenuItem(language.get("High Contrast Color")); // CORRELATION FILTER ELEMENTS JPanel leftPanel = new JPanel(new BorderLayout()); this.moleculeFilterPanel = new MoleculeFilterPanel(); leftPanel.add(moleculeFilterPanel, BorderLayout.CENTER); this.correlationFilterPanel = new CorrelationFilterPanel(); leftPanel.add(this.correlationFilterPanel, BorderLayout.SOUTH); //CALCULATION MENU this.correlationMethodMenu.setMnemonic(KeyEvent.VK_C); this.correlationMethodMenu.getAccessibleContext() .setAccessibleDescription(language.get("Perform Data Calculations")); this.correlationMethodMenuButtonGroup.add(this.pearsonCalculationMenuItem); this.correlationMethodMenuButtonGroup.add(this.spearmanCalculationMenuItem); this.correlationMethodMenuButtonGroup.add(this.kendallCalculationMenuItem); this.pearsonCalculationMenuItem.setMnemonic(KeyEvent.VK_P); this.spearmanCalculationMenuItem.setMnemonic(KeyEvent.VK_S); this.kendallCalculationMenuItem.setMnemonic(KeyEvent.VK_K); this.correlationMethodMenu.add(this.pearsonCalculationMenuItem); this.correlationMethodMenu.add(this.spearmanCalculationMenuItem); this.correlationMethodMenu.add(this.kendallCalculationMenuItem); this.pearsonCalculationMenuItem.addItemListener(this); this.spearmanCalculationMenuItem.addItemListener(this); this.kendallCalculationMenuItem.addItemListener(this); //LAYOUT MENU LayoutChangeListener lcl = new LayoutChangeListener(); this.layoutMenu.setMnemonic(KeyEvent.VK_L); this.layoutMenu.getAccessibleContext() .setAccessibleDescription(language.get("Change the layout of the graph")); this.layoutMenuButtonGroup.add(this.multipleCirclesLayoutMenuItem); this.layoutMenuButtonGroup.add(this.singleCircleLayoutMenuItem); this.layoutMenuButtonGroup.add(this.randomLayoutMenuItem); this.layoutMenuButtonGroup.add(this.kkLayoutMenuItem); // this.layoutMenuButtonGroup.add( this.frLayoutMenuItem ); // this.layoutMenuButtonGroup.add( this.springLayoutMenuItem ); this.layoutMenuButtonGroup.add(this.frSpringLayoutMenuItem); this.layoutMenuButtonGroup.add(this.heatMapLayoutMenuItem); Enumeration<AbstractButton> e = this.layoutMenuButtonGroup.getElements(); this.layoutMenu.add(this.multipleCirclesLayoutMenuItem); this.layoutMenu.add(this.singleCircleLayoutMenuItem); this.layoutMenu.add(this.randomLayoutMenuItem); this.layoutMenu.add(this.kkLayoutMenuItem); // this.layoutMenu.add( this.frLayoutMenuItem ); // this.layoutMenu.add( this.springLayoutMenuItem ); this.layoutMenu.add(this.frSpringLayoutMenuItem); this.layoutMenu.add(this.heatMapLayoutMenuItem); // this.layoutMenu.addSeparator( ); // this.layoutMenu.add( this.animatedLayoutMenuItem ); this.multipleCirclesLayoutMenuItem.addActionListener(lcl); this.multipleCirclesLayoutMenuItem.setEnabled(false); this.singleCircleLayoutMenuItem.addActionListener(lcl); this.randomLayoutMenuItem.addActionListener(lcl); this.kkLayoutMenuItem.addActionListener(lcl); // this.frLayoutMenuItem.addActionListener( lcl ); this.frSpringLayoutMenuItem.addActionListener(lcl); this.heatMapLayoutMenuItem.addActionListener(lcl); // this.animatedLayoutMenuItem.addActionListener( lcl ); //VIEW MENU this.viewMenu.add(this.colorMenu); this.viewMenu.addSeparator(); this.viewMenu.setMnemonic(KeyEvent.VK_V); this.viewMenu.getAccessibleContext() .setAccessibleDescription(language.get("Change the data view settings")); this.viewMenu.add(this.zoomOutViewMenuItem); this.viewMenu.add(this.zoomInViewMenuItem); this.viewMenu.add(this.fitToWindowViewMenuItem); this.viewMenu.addSeparator(); this.viewMenu.add(this.selectAllViewMenuItem); this.viewMenu.add(this.clearSelectionViewMenuItem); this.viewMenu.add(this.invertSelectionViewMenuItem); this.viewMenu.add(this.selectCorrelatedViewMenuItem); this.viewMenu.addSeparator(); this.viewMenu.add(this.hideSelectedViewMenuItem); this.viewMenu.add(this.hideUnselectedViewMenuItem); this.viewMenu.add(this.hideUncorrelatedViewMenuItem); this.viewMenu.add(this.hideOrphansViewMenuItem); this.viewMenu.add(this.showCorrelatedViewMenuItem); this.viewMenu.addSeparator(); this.viewMenu.add(this.saveImageAction); this.resetSampleGroupsMenuItem.addActionListener(this); this.chooseSampleGroupsMenuItem.addActionListener(this); this.zoomOutViewMenuItem.addActionListener(this); this.zoomInViewMenuItem.addActionListener(this); this.fitToWindowViewMenuItem.addActionListener(this); this.selectAllViewMenuItem.addActionListener(this); this.clearSelectionViewMenuItem.addActionListener(this); this.invertSelectionViewMenuItem.addActionListener(this); this.selectCorrelatedViewMenuItem.addActionListener(this); this.hideSelectedViewMenuItem.addActionListener(this); this.hideUnselectedViewMenuItem.addActionListener(this); this.hideUncorrelatedViewMenuItem.addActionListener(this); this.hideOrphansViewMenuItem.addActionListener(this); this.showCorrelatedViewMenuItem.addActionListener(this); this.selectAllViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK)); this.clearSelectionViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)); // GROUPS MENU this.groupsMenu.setMnemonic(KeyEvent.VK_G); this.groupsMenu.add(this.resetSampleGroupsMenuItem); this.groupsMenu.add(this.chooseSampleGroupsMenuItem); this.zoomOutViewMenuItem .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK)); this.zoomInViewMenuItem .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_DOWN_MASK)); this.fitToWindowViewMenuItem .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_0, InputEvent.CTRL_DOWN_MASK)); this.hideSelectedViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); //COLOR MENU this.colorMenu.setMnemonic(KeyEvent.VK_R); this.colorMenu.getAccessibleContext() .setAccessibleDescription(language.get("Change the color of the graph")); this.colorMenuButtonGroup.add(this.normalColorMenuItem); this.colorMenuButtonGroup.add(this.highContrastColorMenuItem); this.colorMenu.add(this.normalColorMenuItem); this.colorMenu.add(this.highContrastColorMenuItem); this.normalColorMenuItem.addItemListener(this); this.highContrastColorMenuItem.addItemListener(this); this.menuBar.add(this.correlationMethodMenu); this.menuBar.add(this.layoutMenu); this.menuBar.add(this.viewMenu); this.menuBar.add(this.groupsMenu); // Add the panels to the main panel this.add(menuBar, BorderLayout.NORTH); // this.add( this.correlationViewPanel, BorderLayout.CENTER ); this.add(leftPanel, BorderLayout.WEST); }
From source file:livecanvas.mesheditor.MeshEditor.java
public JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu menu, subMenu;/*from w w w. j ava 2 s . c o m*/ JMenuItem menuItem; menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); menu.add(menuItem = Utils.createMenuItem("New", NEW, KeyEvent.VK_N, "ctrl N", this)); menu.add(menuItem = Utils.createMenuItem("Open...", OPEN, KeyEvent.VK_O, "ctrl O", this)); menu.add(menuItem = Utils.createMenuItem("Save", SAVE, KeyEvent.VK_S, "ctrl S", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Exit", EXIT, KeyEvent.VK_X, "", this)); menuBar.add(menu); menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); menu.add(menuItem = Utils.createMenuItem("Undo", UNDO, KeyEvent.VK_U, "ctrl Z", this)); menu.add(menuItem = Utils.createMenuItem("Redo", REDO, KeyEvent.VK_R, "ctrl Y", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Cut", CUT, KeyEvent.VK_T, "ctrl X", this)); menu.add(menuItem = Utils.createMenuItem("Copy", COPY, KeyEvent.VK_C, "ctrl C", this)); menu.add(menuItem = Utils.createMenuItem("Paste", PASTE, KeyEvent.VK_P, "ctrl V", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Select All", SELECT_ALL, KeyEvent.VK_A, "ctrl A", this)); menu.add(menuItem = Utils.createMenuItem("Invert Selection", INVERT_SELECTION, 0, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Settings...", SETTINGS, KeyEvent.VK_S, "", this)); menuBar.add(menu); menu = new JMenu("Tools"); menu.setMnemonic(KeyEvent.VK_T); menu.add(menuItem = Utils.createMenuItem("Brush", TOOLS_BRUSH, KeyEvent.VK_B, "B", this)); menu.add(menuItem = Utils.createMenuItem("Pencil", TOOLS_PEN, KeyEvent.VK_N, "N", this)); menu.add(menuItem = Utils.createMenuItem("Magic Wand", TOOLS_MAGICWAND, KeyEvent.VK_W, "W", this)); menu.add(menuItem = Utils.createMenuItem("Set Control Points", TOOLS_SETCONTROLPOINTS, KeyEvent.VK_C, "C", this)); menu.add(menuItem = Utils.createMenuItem("Pointer", TOOLS_POINTER, KeyEvent.VK_P, "P", this)); menu.add(menuItem = Utils.createMenuItem("Pan / Zoom", TOOLS_PANZOOM, KeyEvent.VK_Z, "Z", this)); menuBar.add(menu); menu = new JMenu("Layers"); menu.setMnemonic(KeyEvent.VK_L); menu.add(menuItem = Utils.createMenuItem("Add Layer...", ADD_LAYER, KeyEvent.VK_A, "", this)); menu.add(menuItem = Utils.createMenuItem("Remove", REMOVE_LAYER, KeyEvent.VK_R, "", this)); menu.add(menuItem = Utils.createMenuItem("Duplicate", DUPLICATE_LAYER, KeyEvent.VK_C, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Move Up", MOVEUP_LAYER, KeyEvent.VK_U, "", this)); menu.add(menuItem = Utils.createMenuItem("Move Down", MOVEDOWN_LAYER, KeyEvent.VK_D, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Reparent Layer...", REPARENT_LAYER, KeyEvent.VK_R, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Group Layers", GROUP_LAYERS, KeyEvent.VK_G, "", this)); menu.add(menuItem = Utils.createMenuItem("Ungroup Layer", UNGROUP_LAYER, KeyEvent.VK_N, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Join Layers", JOIN_LAYERS, KeyEvent.VK_J, "", this)); menu.add(menuItem = Utils.createMenuItem("Intersect", INTERSECT_LAYERS, KeyEvent.VK_I, "", this)); menu.add(menuItem = Utils.createMenuItem("Subtract", SUBTRACT_LAYERS, KeyEvent.VK_S, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Rename...", RENAME_LAYER, KeyEvent.VK_E, "", this)); menu.addSeparator(); subMenu = new JMenu("Background Reference"); subMenu.add(menuItem = Utils.createMenuItem("Set...", BGREF_SET, KeyEvent.VK_S, "", this)); subMenu.add(menuItem = Utils.createMenuItem("Remove", BGREF_REMOVE, KeyEvent.VK_R, "", this)); menu.add(subMenu); menuBar.add(menu); menu.addSeparator(); menu.add(menuItem = Utils.createMenuItem("Create Mesh Grid", CREATE_MESHGRID, KeyEvent.VK_M, "", this)); menu.addSeparator(); menu.add(menuItem = Utils.createCheckBoxMenuItem("See Through", SEE_THROUGH, KeyEvent.VK_T, "", this)); menuItem.setSelected(true); menu.add(menuItem = Utils.createCheckBoxMenuItem("Show Mesh", SHOW_MESH, KeyEvent.VK_M, "", this)); menuItem.setSelected(true); return menuBar; }
From source file:org.photovault.swingui.BrowserWindow.java
protected void createUI(PhotoCollection collection) { window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); tabPane = new JTabbedPane(); queryPane = new QueryPane(); PhotoFolderTreeController treeCtrl = new PhotoFolderTreeController(window, this); viewCtrl = new PhotoViewController(window, this); treePane = treeCtrl.folderTree;/* w ww . j a v a2 s. c om*/ viewPane = viewCtrl.getThumbPane(); previewPane = viewCtrl.getPreviewPane(); tabPane.addTab("Query", queryPane); tabPane.addTab("Folders", treePane); VolumeTreeController volTreeCtrl = new VolumeTreeController(this); JTree volumeTree = volTreeCtrl.getView(); JScrollPane voltreeScrollPane = new JScrollPane(volumeTree); voltreeScrollPane.setPreferredSize(new Dimension(200, 500)); tabPane.add("Volumes", voltreeScrollPane); // TODO: get rid of this!!!! EditSelectionColorsAction colorAction = (EditSelectionColorsAction) viewPane.getEditSelectionColorsAction(); colorAction.setPreviewCtrl(previewPane); // Set listeners to both query and folder tree panes /* If an actionEvent comes from query pane, swich to query results. */ queryPane.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewCtrl.setCollection(queryPane.getResultCollection()); } }); /* If the selected folder is changed in treePane, switch to that immediately */ treeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() { public void handleEvent(DefaultEvent<PhotoCollection> event) { PhotoCollection c = event.getPayload(); if (c != null) { viewCtrl.setCollection(c); if (c instanceof PhotoFolder) { PhotoFolder f = (PhotoFolder) c; if (f.getExternalDir() != null) { ExternalDir ed = f.getExternalDir(); folderIndexer.updateDir(ed.getVolume(), ed.getPath()); viewCtrl.setIndexingOngoing(true); } } } } }); volTreeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() { public void handleEvent(DefaultEvent<PhotoCollection> event) { PhotoCollection c = event.getPayload(); if (c != null) { viewCtrl.setCollection(c); if (c instanceof ExtDirPhotos) { ExtDirPhotos photos = (ExtDirPhotos) c; ExternalVolume vol = (ExternalVolume) viewCtrl.getDAOFactory().getVolumeDAO() .getVolume(photos.getVolId()); folderIndexer.updateDir(vol, photos.getDirPath()); viewCtrl.setIndexingOngoing(true); } } } }); collectionPane = viewCtrl.getCollectionPane(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tabPane, collectionPane); split.putClientProperty(JSplitPane.ONE_TOUCH_EXPANDABLE_PROPERTY, new Boolean(true)); Container cp = window.getContentPane(); cp.setLayout(new BorderLayout()); cp.add(split, BorderLayout.CENTER); statusBar = new StatusBar(); cp.add(statusBar, BorderLayout.SOUTH); // Create actions for BrowserWindow UI ImageIcon indexDirIcon = getIcon("index_dir.png"); DefaultAction indexDirAction = new DefaultAction("Index directory...", indexDirIcon) { public void actionPerformed(ActionEvent e) { indexDir(); } }; indexDirAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_D); indexDirAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Index all images in a directory"); this.registerAction("new_ext_vol", indexDirAction); ImageIcon importIcon = getIcon("import.png"); importAction = new AbstractAction("Import image...", importIcon) { public void actionPerformed(ActionEvent e) { importFile(); } }; importAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O); importAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); importAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Import new image into database"); ImageIcon updateIcon = getIcon("update_indexed_dirs.png"); UpdateIndexAction updateIndexAction = new UpdateIndexAction(viewCtrl, "Update indexed dirs", updateIcon, "Check for changes in previously indexed directories", KeyEvent.VK_U); this.registerAction("update_indexed_dirs", updateIndexAction); updateIndexAction.addStatusChangeListener(statusBar); ImageIcon previewTopIcon = getIcon("view_preview_top.png"); DefaultAction previewTopAction = new DefaultAction("Preview on top", previewTopIcon) { public void actionPerformed(ActionEvent e) { viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_HORIZONTAL_THUMBS); } }; previewTopAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on top of thumbnails"); previewTopAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_T); this.registerAction("view_preview_top", previewTopAction); ImageIcon previewRightIcon = getIcon("view_preview_right.png"); DefaultAction previewRightAction = new DefaultAction("Preview on right", previewRightIcon) { public void actionPerformed(ActionEvent e) { viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_VERTICAL_THUMBS); } }; previewRightAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on right of thumbnails"); previewRightAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_R); this.registerAction("view_preview_right", previewRightAction); ImageIcon previewNoneIcon = getIcon("view_no_preview.png"); DefaultAction previewNoneAction = new DefaultAction("No preview", previewNoneIcon) { public void actionPerformed(ActionEvent e) { viewCtrl.setLayout(PhotoViewController.Layout.ONLY_THUMBS); } }; previewNoneAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show no preview image"); previewNoneAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O); this.registerAction("view_no_preview", previewNoneAction); DefaultAction previewLargeAction = new DefaultAction("Large", null) { public void actionPerformed(ActionEvent e) { viewCtrl.setPreviewSize(200); } }; DefaultAction previewSmallAction = new DefaultAction("Small", null) { public void actionPerformed(ActionEvent e) { viewCtrl.setPreviewSize(100); } }; JToolBar tb = createToolbar(); cp.add(tb, BorderLayout.NORTH); // Create the menu bar & menus JMenuBar menuBar = new JMenuBar(); window.setJMenuBar(menuBar); // File menu JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu); JMenuItem newWindowItem = new JMenuItem("New window", KeyEvent.VK_N); newWindowItem.setIcon(getIcon("window_new.png")); newWindowItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { BrowserWindow br = new BrowserWindow(getParentController(), null); // br.setVisible( true ); } }); fileMenu.add(newWindowItem); JMenuItem importItem = new JMenuItem(importAction); fileMenu.add(importItem); JMenuItem indexDirItem = new JMenuItem(indexDirAction); fileMenu.add(indexDirItem); fileMenu.add(new JMenuItem(viewCtrl.getActionAdapter("update_indexed_dirs"))); ExportSelectedAction exportAction = (ExportSelectedAction) viewPane.getExportSelectedAction(); JMenuItem exportItem = new JMenuItem(exportAction); exportAction.addStatusChangeListener(statusBar); fileMenu.add(exportItem); JMenu dbMenu = new JMenu("Database"); dbMenu.setMnemonic(KeyEvent.VK_B); dbMenu.setIcon(getIcon("empty_icon.png")); ExportMetadataAction exportMetadata = new ExportMetadataAction("Export as XML...", null, "Export whole database as XML file", KeyEvent.VK_E); dbMenu.add(new JMenuItem(exportMetadata)); ImportXMLAction importMetadata = new ImportXMLAction("Import XML data...", null, "Import data from other Photovault database as XML", KeyEvent.VK_I); importMetadata.addStatusChangeListener(statusBar); dbMenu.add(new JMenuItem(importMetadata)); fileMenu.add(dbMenu); JMenuItem exitItem = new JMenuItem("Exit", KeyEvent.VK_X); exitItem.setIcon(getIcon("exit.png")); exitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); fileMenu.add(exitItem); JMenu viewMenu = new JMenu("View"); viewMenu.setMnemonic(KeyEvent.VK_V); menuBar.add(viewMenu); JMenuItem vertIconsItem = new JMenuItem(previewRightAction); viewMenu.add(vertIconsItem); JMenuItem horzIconsItem = new JMenuItem(previewTopAction); viewMenu.add(horzIconsItem); JMenuItem noPreviewItem = new JMenuItem(previewNoneAction); viewMenu.add(noPreviewItem); JMenuItem nextPhotoItem = new JMenuItem(viewPane.getSelectNextAction()); viewMenu.add(nextPhotoItem); JMenuItem prevPhotoItem = new JMenuItem(viewPane.getSelectPreviousAction()); viewMenu.add(prevPhotoItem); viewMenu.add(new JMenuItem(previewSmallAction)); viewMenu.add(new JMenuItem(previewLargeAction)); JMenu sortMenu = new JMenu("Sort by"); sortMenu.setMnemonic(KeyEvent.VK_S); sortMenu.setIcon(getIcon("empty_icon.png")); JMenuItem byDateItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingDateComparator(), "Date", null, "Order photos by date", KeyEvent.VK_D)); sortMenu.add(byDateItem); JMenuItem byPlaceItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingPlaceComparator(), "Place", null, "Order photos by shooting place", KeyEvent.VK_P)); sortMenu.add(byPlaceItem); JMenuItem byQualityItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new QualityComparator(), "Quality", null, "Order photos by quality", KeyEvent.VK_Q)); sortMenu.add(byQualityItem); viewMenu.add(sortMenu); // Set default ordering by date byDateItem.getAction().actionPerformed(new ActionEvent(this, 0, "Setting default")); JMenu imageMenu = new JMenu("Image"); imageMenu.setMnemonic(KeyEvent.VK_I); menuBar.add(imageMenu); imageMenu.add(new JMenuItem(viewPane.getEditSelectionPropsAction())); imageMenu.add(new JMenuItem(viewPane.getShowSelectedPhotoAction())); imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_cw"))); imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_ccw"))); imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_180"))); imageMenu.add(new JMenuItem(previewPane.getCropAction())); imageMenu.add(new JMenuItem(viewPane.getEditSelectionColorsAction())); imageMenu.add(new JMenuItem(viewPane.getDeleteSelectedAction())); // Create the Quality submenu JMenu qualityMenu = new JMenu("Quality"); qualityMenu.setIcon(getIcon("empty_icon.png")); for (int n = 0; n < 6; n++) { Action qualityAction = viewCtrl.getActionAdapter("quality_" + n); JMenuItem qualityMenuItem = new JMenuItem(qualityAction); qualityMenu.add(qualityMenuItem); } imageMenu.add(qualityMenu); JMenu aboutMenu = new JMenu("About"); aboutMenu.setMnemonic(KeyEvent.VK_A); aboutMenu.add(new JMenuItem(new ShowAboutDlgAction("About Photovault...", null, "", null))); menuBar.add(Box.createHorizontalGlue()); menuBar.add(aboutMenu); window.pack(); window.setVisible(true); }
From source file:org.geopublishing.atlasStyler.swing.AtlasStylerGUI.java
/** * This method initializes jToolBar//from ww w .j a v a 2 s. c om * * @return javax.swing.JToolBar */ private JToolBar getJToolBar() { JToolBar jToolBar = new JToolBar(); jToolBar.setFloatable(false); AbstractAction importWiazrdAction = new AbstractAction( AtlasStylerVector.R("MenuBar.FileMenu.ImportWizard")) { @Override public void actionPerformed(ActionEvent e) { ImportWizard.showWizard(AtlasStylerGUI.this, AtlasStylerGUI.this); } }; importWiazrdAction.putValue(Action.LONG_DESCRIPTION, KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK, true)); jToolBar.add(importWiazrdAction); jToolBar.add(getJTButtonShowXML()); jToolBar.add(getJTButtonExportAsSLD()); return jToolBar; }
From source file:es.emergya.ui.gis.FleetControlMapViewer.java
@Override protected JPopupMenu getContextMenu() { JPopupMenu menu = new JPopupMenu(); menu.setBackground(Color.decode("#E8EDF6")); // Ttulo//from w w w .ja v a 2 s. co m final JMenuItem titulo = new JMenuItem(i18n.getString("map.menu.titulo.puntoGenerico")); titulo.setFont(LogicConstants.deriveBoldFont(10.0f)); titulo.setBackground(Color.decode("#A4A4A4")); titulo.setFocusable(false); menu.add(titulo); menu.addSeparator(); // Actualizar posicin final JMenuItem gps = new JMenuItem(i18n.getString("map.menu.gps"), KeyEvent.VK_P); gps.setIcon(LogicConstants.getIcon("menucontextual_icon_actualizargps")); menu.add(gps); gps.addActionListener(this); gps.setEnabled(false); menu.addSeparator(); // Mostrar ms cercanos final JMenuItem mmc = new JMenuItem(i18n.getString("map.menu.showNearest"), KeyEvent.VK_M); mmc.setIcon(LogicConstants.getIcon("menucontextual_icon_mascercano")); mmc.addActionListener(this); menu.add(mmc); // Centrar aqui final JMenuItem cent = new JMenuItem(i18n.getString("map.menu.centerHere"), KeyEvent.VK_C); cent.setIcon(LogicConstants.getIcon("menucontextual_icon_centrar")); cent.addActionListener(this); menu.add(cent); // Nueva Incidencia final JMenuItem newIncidence = new JMenuItem(i18n.getString("map.menu.newIncidence"), KeyEvent.VK_I); newIncidence.setIcon(LogicConstants.getIcon("menucontextual_icon_newIncidence")); newIncidence.addActionListener(this); menu.add(newIncidence); // Calcular ruta desde aqui final JMenuItem from = new JMenuItem(i18n.getString("map.menu.route.from"), KeyEvent.VK_D); from.setIcon(LogicConstants.getIcon("menucontextual_icon_origenruta")); from.addActionListener(this); menu.add(from); // Calcular ruta hasta aqui final JMenuItem to = new JMenuItem(i18n.getString("map.menu.route.to"), KeyEvent.VK_H); to.setIcon(LogicConstants.getIcon("menucontextual_icon_destinoruta")); to.addActionListener(this); menu.add(to); menu.addSeparator(); // Ver ficha [recurso / incidencia] final JMenuItem summary = new JMenuItem(i18n.getString("map.menu.summary"), KeyEvent.VK_F); summary.setIcon(LogicConstants.getIcon("menucontextual_icon_ficha")); summary.addActionListener(this); menu.add(summary); summary.setEnabled(false); menu.addPopupMenuListener(new PopupMenuListener() { @SuppressWarnings("unchecked") @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { eventOriginal = FleetControlMapViewer.this.mapView.lastMEvent; gps.setEnabled(false); summary.setEnabled(false); titulo.setText(i18n.getString("map.menu.titulo.puntoGenerico")); menuObjective = null; Point p = new Point(mapView.lastMEvent.getX(), mapView.lastMEvent.getY()); for (Layer l : mapView.getAllLayers()) { // por cada capa... if (l instanceof MarkerLayer) { // ...de marcadores for (Marker marker : ((MarkerLayer) l).data) { // miramos // los // marcadores if ((marker instanceof CustomMarker) && marker.containsPoint(p)) { // y si // estamos // pinchando // en uno CustomMarker m = (CustomMarker) marker; log.trace("Hemos pinchado en " + marker); switch (m.getType()) { case RESOURCE: Recurso r = (Recurso) m.getObject(); log.trace("Es un recurso: " + r); if (r != null) { menuObjective = r; if (r.getPatrullas() != null) { titulo.setText( i18n.getString(Locale.ROOT, "map.menu.titulo.recursoPatrulla", r.getIdentificador(), r.getPatrullas())); } else { titulo.setText(r.getIdentificador()); } gps.setEnabled(true); summary.setEnabled(true); } break; case INCIDENCE: Incidencia i = (Incidencia) m.getObject(); log.trace("Es una incidencia: " + i); if (i != null) { menuObjective = i; titulo.setText(i.getTitulo()); gps.setEnabled(false); summary.setEnabled(true); } break; case UNKNOWN: log.trace("Hemos pinchado en un marcador desconocido"); break; } } } } } } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { } @Override public void popupMenuCanceled(PopupMenuEvent e) { } }); return menu; }
From source file:uk.ac.abdn.csd.p2p.server.ServerGUI.java
/** * This method prepares all the graphical components that are contained with P2P Visualisation Server. *//* w w w . j ava 2 s . c om*/ // <editor-fold defaultstate="collapsed" desc="...GUI"> private void initializeComponent() { listeningPort = 0; JFrame frame = new JFrame(); BorderLayout layout = new BorderLayout(); //create a graph overlay = new UndirectedSparseGraph<Vertex, Edge>(); ObservableGraph<Vertex, Edge> og = new ObservableGraph<Vertex, Edge>(overlay); /* og.addGraphEventListener(new GraphEventListener<Vertex, Edge>() { @Override public void handleGraphEvent( GraphEvent<Vertex, Edge> evt) { System.err.println("got " + evt); } });*/ this.overlay = og; layout1 = new FRLayout2<Vertex, Edge>(overlay); vv = new VisualizationViewer<Vertex, Edge>(layout1, new Dimension(700, 200)); vv.setGraphMouse(new DefaultModalGraphMouse<Vertex, Edge>()); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Vertex>()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<Edge>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); vv.getRenderContext().setVertexFillPaintTransformer(new VertexPainter()); DefaultModalGraphMouse gm1 = new DefaultModalGraphMouse(); gm1.setMode(ModalGraphMouse.Mode.TRANSFORMING); gm1.setMode(ModalGraphMouse.Mode.PICKING); gm1.add(new MyPopupGraphMousePlugin()); vv.setGraphMouse(gm1); vv.addKeyListener(gm1.getModeKeyListener()); contentPane = new JPanel(layout); displayPanel = new javax.swing.JPanel(); consoleTextArea = new JTextArea(); jScrollPane2 = new JScrollPane(); clearButton = new JButton(); consolePanel = new JPanel(); clearButton = new javax.swing.JButton(); nodeTextArea = new JTextArea(); jScrollPane1 = new JScrollPane(); nodePanel = new JPanel(); linkTextArea = new JTextArea(); jScrollPane3 = new JScrollPane(); linkPanel = new JPanel(); menuBar = new javax.swing.JMenuBar(); serverMenu = new javax.swing.JMenu(); startServerMenuItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); exitMenuItem = new javax.swing.JMenuItem(); editMenu = new javax.swing.JMenu(); settingMenuItem = new javax.swing.JMenuItem(); colorSettingMenuItem = new javax.swing.JMenuItem(); toolMenuItem = new javax.swing.JMenu(); clearMenuItem = new javax.swing.JMenuItem(); helpMenu = new javax.swing.JMenu(); aboutMenuItem = new javax.swing.JMenuItem(); zoominMenuItem = new javax.swing.JMenuItem(); zoomoutMenuItem = new javax.swing.JMenuItem(); layoutSettingMenuItem = new javax.swing.JMenuItem(); labelPositionMenuItem = new javax.swing.JMenuItem(); speedSettingMenuItem = new javax.swing.JMenuItem(); topologySettingMenuItem = new javax.swing.JMenuItem(); findNodeMenuItem = new javax.swing.JMenuItem(); serverMenu.setText("Server"); serverMenu.setToolTipText("Server"); startServerMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK)); startServerMenuItem.setText("Start Server"); startServerMenuItem.setToolTipText("Start Server"); startServerMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { startServerMenuItemActionPerformed(evt); } }); serverMenu.add(startServerMenuItem); serverMenu.add(jSeparator1); exitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK)); exitMenuItem.setText("Exit"); exitMenuItem.setToolTipText("Exit"); exitMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); serverMenu.add(exitMenuItem); menuBar.add(serverMenu); editMenu.setText("Edit"); editMenu.setToolTipText("Edit"); settingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK)); settingMenuItem.setText("Server Settings"); settingMenuItem.setToolTipText("Server Settings"); settingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { settingMenuItemActionPerformed(evt); } }); editMenu.add(settingMenuItem); colorSettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.ALT_MASK)); colorSettingMenuItem.setText("Colour Settings"); colorSettingMenuItem.setToolTipText("Colour Settings"); colorSettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { colorSettingMenuItemActionPerformed(evt); } }); editMenu.add(colorSettingMenuItem); layoutSettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK)); layoutSettingMenuItem.setText("Layout Settings"); layoutSettingMenuItem.setToolTipText("Layout Settings"); layoutSettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { layoutSettingMenuItemActionPerformed(evt); } }); editMenu.add(layoutSettingMenuItem); speedSettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.ALT_MASK)); speedSettingMenuItem.setText("Speed Settings"); speedSettingMenuItem.setToolTipText("Speed Settings"); speedSettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { speedSettingMenuItemActionPerformed(evt); } }); editMenu.add(speedSettingMenuItem); topologySettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK)); topologySettingMenuItem.setText("Topology Settings"); topologySettingMenuItem.setToolTipText("Topology Settings"); topologySettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { topologySettingMenuItemActionPerformed(evt); } }); editMenu.add(topologySettingMenuItem); menuBar.add(editMenu); toolMenuItem.setText("Tools"); toolMenuItem.setToolTipText("Tools"); labelPositionMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK)); labelPositionMenuItem.setText("Vertex Label Position"); labelPositionMenuItem.setToolTipText("Vertex Label Position"); toolMenuItem.add(labelPositionMenuItem); labelPositionMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { labelPositionMenuItemActionPerformed(evt); } }); final ScalingControl scaler = new CrossoverScalingControl(); zoominMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK)); zoominMenuItem.setText("Zoom-In"); zoominMenuItem.setToolTipText("Zoom-In"); toolMenuItem.add(zoominMenuItem); zoominMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); zoomoutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK)); zoomoutMenuItem.setText("Zoom-Out"); zoomoutMenuItem.setToolTipText("Zoom-Out"); toolMenuItem.add(zoomoutMenuItem); zoomoutMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { scaler.scale(vv, 0.9f, vv.getCenter()); } }); findNodeMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK)); findNodeMenuItem.setText("Find Node on Overlay"); findNodeMenuItem.setToolTipText("Find Node"); toolMenuItem.add(findNodeMenuItem); findNodeMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { findNodeMenuItemMenuItemActionPerformed(evt); } }); menuBar.add(toolMenuItem); helpMenu.setText("Help"); helpMenu.setToolTipText("Help"); aboutMenuItem.setText("About"); aboutMenuItem.setToolTipText("About"); aboutMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { aboutMenuItemActionPerformed(evt); } }); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); displayPanel.setLayout(new BorderLayout()); displayPanel.setBorder(new TitledBorder("P2P Overlay")); displayPanel.add(vv); validate(); // // nodeTextArea // nodeTextArea.setEditable(false); nodeTextArea.setLineWrap(true); // // jScrollPane1 // jScrollPane1.setViewportView(nodeTextArea); //jScrollPane1.setsi // // nodePanel // nodePanel.setLayout(new BoxLayout(nodePanel, BoxLayout.X_AXIS)); nodePanel.add(jScrollPane1, 0); nodePanel.setBorder(new TitledBorder("Nodes Active")); // // linkTextArea // linkTextArea.setEditable(false); linkTextArea.setLineWrap(true); // // jScrollPane3 // jScrollPane3.setViewportView(linkTextArea); // // linkPanel // linkPanel.setLayout(new BoxLayout(linkPanel, BoxLayout.X_AXIS)); linkPanel.add(jScrollPane3, 0); linkPanel.setBorder(new TitledBorder("Node Links")); // // consoleTextArea // consoleTextArea.setEditable(false); consoleTextArea.setLineWrap(true); // // jScrollPane2 // jScrollPane2.setViewportView(consoleTextArea); // // clearButton // clearButton.setText("Clear"); clearButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearButton_actionPerformed(e); } }); // // consolePanel // consolePanel.setLayout(new BoxLayout(consolePanel, BoxLayout.X_AXIS)); consolePanel.add(jScrollPane2, 0); consolePanel.add(clearButton, 1); consolePanel.setBorder(new TitledBorder("Console")); // // ServerGUI // Dimension panelD = new Dimension(700, 330); // display Panel Dimension panelD1 = new Dimension(700, 134); // control Panel Dimension panelD2 = new Dimension(350, 140); // nodepanel and linkpanel Dimension panelD3 = new Dimension(700, 140); // nodepanel and linkpanel togther consolePanel.setPreferredSize(panelD1); displayPanel.setPreferredSize(panelD); nodePanel.setPreferredSize(panelD2); linkPanel.setPreferredSize(panelD2); Box box = new Box(BoxLayout.X_AXIS); // put nodepanel and linkpanel in one box box.add(nodePanel); box.add(linkPanel); box.setSize(panelD3); //contentPane.add(BorderLayout.NORTH,displayPanel); //contentPane.add(BorderLayout.CENTER,box); contentPane.add(BorderLayout.NORTH, box); contentPane.add(BorderLayout.CENTER, displayPanel); contentPane.add(BorderLayout.SOUTH, consolePanel); frame.setJMenuBar(menuBar); frame.getContentPane().add(contentPane); frame.setTitle("P2P Visualisation Server"); frame.setSize(new Dimension(800, 600)); frame.setResizable(true); // This code has been adapted from http://lookass.ch/?id=4&area=art&art=47 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = frame.getSize(); screenSize.height = screenSize.height / 2; screenSize.width = screenSize.width / 2; size.height = size.height / 2; size.width = size.width / 2; int y = screenSize.height - size.height; int x = screenSize.width - size.width; frame.setLocation(x, y); frame.setVisible(true); frame.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); }
From source file:com.googlecode.bpmn_simulator.gui.BPMNSimulatorFrame.java
@Override protected JMenu createWindowMenu() { final JMenu menuWindow = new JMenu(Messages.getString("Menu.windows")); //$NON-NLS-1$ final JMenuItem menuWindowElements = new JMenuItem(Messages.getString("Menu.elements")); //$NON-NLS-1$ menuWindowElements.setMnemonic(KeyEvent.VK_E); menuWindowElements.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK)); menuWindowElements.addActionListener(new ActionListener() { @Override/*from w w w.ja v a 2s . com*/ public void actionPerformed(final ActionEvent e) { showElementsFrame(); } }); menuWindow.add(menuWindowElements); final JMenuItem menuWindowInstances = new JMenuItem(Messages.getString("Menu.instances")); //$NON-NLS-1$ menuWindowInstances.setMnemonic(KeyEvent.VK_I); menuWindowInstances.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.ALT_MASK)); menuWindowInstances.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { showInstancesFrame(); } }); menuWindow.add(menuWindowInstances); final JMenu menuWindowDiagram = super.createWindowMenu(); menuWindowDiagram.setText(Messages.getString("Menu.diagrams")); menuWindow.add(menuWindowDiagram); return menuWindow; }
From source file:statechum.analysis.learning.Visualiser.java
protected void setVisualiserKeyBindings() { persistAction = new graphAction("saveLayout", "save the layout of the visible graph") { /** Serial number. */ private static final long serialVersionUID = 1L; @Override//w w w .ja v a 2s .com public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { XMLEncoder encoder = null; try { if (propName >= 0) { String fileName = getLayoutFileName(graphs.get(currentGraph)); encoder = new XMLEncoder(new FileOutputStream(fileName)); Map<Integer, DoublePair> layout = ((XMLPersistingLayout) viewer.getModel().getGraphLayout()) .persist(); encoder.writeObject(layout); XMLAffineTransformSerialised trV = new XMLAffineTransformSerialised(); trV.setFromAffineTransform(viewer.getViewTransformer().getTransform()); encoder.writeObject(trV); XMLAffineTransformSerialised trL = new XMLAffineTransformSerialised(); trL.setFromAffineTransform(viewer.getLayoutTransformer().getTransform()); encoder.writeObject(trL); ((XMLModalGraphMouse) viewer.getGraphMouse()).store(encoder); encoder.writeObject(layoutOptions.get(currentGraph)); encoder.close(); encoder = null; } } catch (Exception e1) { e1.printStackTrace(); } finally { if (encoder != null) { encoder.close(); encoder = null; } } } }; keyToActionMap.put(KeyEvent.VK_F2, persistAction); keyToActionMap.put(KeyEvent.VK_F3, new graphAction("loadLayout", "loads the previously saved layout into the visible graph") { /** Serial number. */ private static final long serialVersionUID = 2L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { reloadLayout(false, true); } }); keyToActionMap.put(KeyEvent.VK_F9, new graphAction("loadPreviousLayout", "loads the layout of the previous graph in the list") { /** Serial number. */ private static final long serialVersionUID = 3L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { if (currentGraph > 0) { restoreLayout(false, currentGraph - 1); } } }); pickAction = new graphAction("pick", "Switches Jung into picking mode") { /** Serial number. */ private static final long serialVersionUID = 7L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { ((XMLModalGraphMouse) viewer.getGraphMouse()).setMode(ModalGraphMouse.Mode.PICKING); } }; keyToActionMap.put(KeyEvent.VK_F11, pickAction); transformAction = new graphAction("transform", "Switches Jung into transformation mode") { /** Serial number. */ private static final long serialVersionUID = 8L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { ((XMLModalGraphMouse) viewer.getGraphMouse()).setMode(ModalGraphMouse.Mode.TRANSFORMING); } }; keyToActionMap.put(KeyEvent.VK_F12, transformAction); keyToActionMap.put(KeyEvent.VK_UP, new graphAction("previous", "loads the previous graph") { /** Serial number. */ private static final long serialVersionUID = 9L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { if (currentGraph > 0) { --currentGraph; reloadLayout(false, true); } } }); keyToActionMap.put(KeyEvent.VK_DOWN, new graphAction("next", "loads the next graph") { /** Serial number. */ private static final long serialVersionUID = 10L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { if (currentGraph < graphs.size() - 1) { ++currentGraph; reloadLayout(false, true); } } }); keyToActionMap.put(KeyEvent.VK_F, new graphAction("negatives", "toggles negatives on or off") { /** Serial number. */ private static final long serialVersionUID = 11L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { LayoutOptions options = layoutOptions.get(currentGraph); if (options != null) { options.showNegatives = !options.showNegatives; reloadLayout(false, false); } } }); keyToActionMap.put(KeyEvent.VK_I, new graphAction("ignored states", "toggles ignored states on or off") { /** Serial number. */ private static final long serialVersionUID = 12L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { LayoutOptions options = layoutOptions.get(currentGraph); if (options != null) { options.showIgnored = !options.showIgnored; reloadLayout(false, false); } } }); keyToActionMap.put(KeyEvent.VK_PAGE_DOWN, new graphAction("refine", "reduces the abstraction level") { /** Serial number. */ private static final long serialVersionUID = 13L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { LayoutOptions options = layoutOptions.get(currentGraph); if (options != null && options.componentsToPick < Integer.MAX_VALUE) { options.componentsToPick++; reloadLayout(false, false); } } }); keyToActionMap.put(KeyEvent.VK_PAGE_UP, new graphAction("abstract", "increases abstraction level") { /** Serial number. */ private static final long serialVersionUID = 14L; @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { LayoutOptions options = layoutOptions.get(currentGraph); if (options != null && options.componentsToPick != Integer.MAX_VALUE && options.componentsToPick > 0) { --options.componentsToPick; reloadLayout(false, false); } } }); }
From source file:com.pingtel.sipviewer.SIPViewerFrame.java
protected void initMenu() { JMenu menu;/*from ww w . j a v a 2s . c o m*/ JMenu submenu; JMenuItem menuItem; JRadioButtonMenuItem rbMenuItem; // Create the menu bar. JMenuBar menuBar = new JMenuBar(); this.setJMenuBar(menuBar); // Build the File menu. menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); menuBar.add(menu); // Add the load-file items to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icOpenFileAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_F); menu.add(menuItem); menuItem = new JMenuItem(); menuItem.setAction(new icImportSyslogAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_Y); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(); menuItem.setAction(new icSaveAsAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_S); menu.add(menuItem); menu.addSeparator(); // Add the reload item to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icReloadAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_R); menu.add(menuItem); menu.addSeparator(); // Add the quit item to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icQuitAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_Q); menu.add(menuItem); // Build the Options menu. menu = new JMenu("Options"); menu.setMnemonic(KeyEvent.VK_O); menuBar.add(menu); // Add the split/single screen mode to the options menu menuItem = new JMenuItem(); menuItem.setAction(new icScreenModeAction()); menuItem.setMnemonic(KeyEvent.VK_M); menu.add(menuItem); menu.addSeparator(); // Add the show all dialogs option to the options menu menuItem = new JMenuItem(); menuItem.setAction(new icShowAllDialogsAction()); menuItem.setMnemonic(KeyEvent.VK_D); menu.add(menuItem); menu.addSeparator(); // Add the Time Zone Selection Time submenu submenu = new JMenu("Time Zone Setting"); submenu.setMnemonic(KeyEvent.VK_Z); ButtonGroup timeZoneGroup = new ButtonGroup(); // Set Time Zone to Local Time Zone m_localTimeZone = new JRadioButtonMenuItem(); m_localTimeZone.setAction(new icSetTimeToLocalZone()); m_localTimeZone.setMnemonic(KeyEvent.VK_L); timeZoneGroup.add(m_localTimeZone); m_localTimeZone.setSelected(true); submenu.add(m_localTimeZone); // Set Time Zone to UTC Time Zone m_utcTimeZone = new JRadioButtonMenuItem(); m_utcTimeZone.setAction(new icSetTimeToUTCZone()); m_utcTimeZone.setMnemonic(KeyEvent.VK_U); timeZoneGroup.add(m_utcTimeZone); submenu.add(m_utcTimeZone); menu.add(submenu); // Add the show/hide time index column menuItem = new JMenuItem(); menuItem.setAction(new icTimeVisibilityAction()); menuItem.setMnemonic(KeyEvent.VK_V); menu.add(menuItem); // Add the Time Display Format submenu submenu = new JMenu("Time Display Format"); submenu.setMnemonic(KeyEvent.VK_T); ButtonGroup group = new ButtonGroup(); m_dateAndTimeFormat = new JRadioButtonMenuItem(); m_dateAndTimeFormat.setAction(new icDateAndTimeAction()); m_dateAndTimeFormat.setMnemonic(KeyEvent.VK_I); group.add(m_dateAndTimeFormat); submenu.add(m_dateAndTimeFormat); m_defaultTimeFormat = new JRadioButtonMenuItem(); m_defaultTimeFormat.setAction(new icTimeOfDay()); m_defaultTimeFormat.setMnemonic(KeyEvent.VK_E); m_defaultTimeFormat.setSelected(true); group.add(m_defaultTimeFormat); submenu.add(m_defaultTimeFormat); m_sincePreviousFormat = new JRadioButtonMenuItem(); m_sincePreviousFormat.setAction(new icSincePrevious()); m_sincePreviousFormat.setMnemonic(KeyEvent.VK_P); group.add(m_sincePreviousFormat); submenu.add(m_sincePreviousFormat); m_sinceBeginningFormat = new JRadioButtonMenuItem(); m_sinceBeginningFormat.setAction(new icSinceBeginning()); m_sinceBeginningFormat.setMnemonic(KeyEvent.VK_B); group.add(m_sinceBeginningFormat); submenu.add(m_sinceBeginningFormat); m_sinceKeyIndexFormat = new JRadioButtonMenuItem(); m_sinceKeyIndexFormat.setAction(new icSinceKeyIndex()); m_sinceKeyIndexFormat.setMnemonic(KeyEvent.VK_K); group.add(m_sinceKeyIndexFormat); submenu.add(m_sinceKeyIndexFormat); menu.add(submenu); // Build the Help menu. menu = new JMenu("Help"); menu.setMnemonic(KeyEvent.VK_H); menuBar.add(menu); // Add the items to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icAboutAction()); menu.add(menuItem); }
From source file:net.sourceforge.entrainer.gui.EntrainerFX.java
private JMenuItem getLicenseItem() { JMenuItem aboutItem = new JMenuItem("License"); addMnemonic(aboutItem, KeyEvent.VK_I); aboutItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { License.showLicenseDialog(); }//from www. j a va2 s .c om }); return aboutItem; }