List of usage examples for java.awt.event ActionEvent CTRL_MASK
int CTRL_MASK
To view the source code for java.awt.event ActionEvent CTRL_MASK.
Click Source Link
From source file:de.tor.tribes.ui.views.DSWorkbenchFormFrame.java
/** Creates new form DSWorkbenchFormFrame */ DSWorkbenchFormFrame() {// ww w .j a va2s . c o m initComponents(); centerPanel = new GenericTestPanel(); jFormPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jFormTablePanel); jFormsTable.setModel(new FormTableModel()); jFormsTable.getSelectionModel().addListSelectionListener(DSWorkbenchFormFrame.this); buildMenu(); KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK, false); KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false); KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); KeyStroke find = KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK, false); capabilityInfoPanel1.addActionListener(this); jFormsTable.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DSWorkbenchFormFrame.getSingleton().actionPerformed(new ActionEvent(jFormsTable, 0, "Copy")); } }, "Copy", copy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jFormsTable.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DSWorkbenchFormFrame.getSingleton().actionPerformed(new ActionEvent(jFormsTable, 0, "BBCopy")); } }, "BBCopy", bbCopy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jFormsTable.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DSWorkbenchFormFrame.getSingleton().actionPerformed(new ActionEvent(jFormsTable, 0, "Delete")); } }, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jFormsTable.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //no find } }, "Find", find, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.form_view", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> }
From source file:de.xplib.xdbm.util.I18N.java
/** * @param keyIn ..//w ww . j a va 2s. com * @return .. */ public KeyStroke getAccelerator(final String keyIn) { String value = this.getValue(keyIn, "accelerator"); if (value.startsWith(keyIn)) { return null; } String[] s = value.toUpperCase().split(","); if (s.length == 0 || s[0].equals("")) { return null; } int code = (int) s[0].charAt(0); int mod = 0; for (int i = 1; i < s.length; i++) { char c = s[i].charAt(0); if (c == 'S') { mod = mod | ActionEvent.SHIFT_MASK; } else if (c == 'A') { mod = mod | ActionEvent.ALT_MASK; } else if (c == 'C') { mod = mod | ActionEvent.CTRL_MASK; } else if (c == 'M') { mod = mod | ActionEvent.META_MASK; } } return KeyStroke.getKeyStroke(code, mod); }
From source file:de.tor.tribes.ui.views.DSWorkbenchDistanceFrame.java
/** * Creates new form DSWorkbenchDistanceFrame *///from w w w . jav a 2s. c om DSWorkbenchDistanceFrame() { initComponents(); centerPanel = new GenericTestPanel(true); jDistancePanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jPanel2); unitBox = new JComboBox(); unitBox.setRenderer(new UnitListCellRenderer()); unitBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cellRenderer.setUnit((UnitHolder) unitBox.getSelectedItem()); jDistanceTable.repaint(); } }); buildMenu(); jDistanceTable.setModel(new DistanceTableModel()); KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK, false); capabilityInfoPanel1.addActionListener(this); jDistanceTable.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DSWorkbenchDistanceFrame.getSingleton() .actionPerformed(new ActionEvent(jDistanceTable, 0, "Delete")); } }, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jDistanceTable.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DSWorkbenchDistanceFrame.getSingleton() .actionPerformed(new ActionEvent(jDistanceTable, 0, "Paste")); } }, "Paste", paste, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jDistanceTable.getActionMap().put("find", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //disable find } }); jDistanceTable.getSelectionModel().addListSelectionListener(DSWorkbenchDistanceFrame.this); cellRenderer.setUnit(UnknownUnit.getSingleton()); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.distance_overview", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> }
From source file:de.tor.tribes.ui.views.DSWorkbenchStatsFrame.java
DSWorkbenchStatsFrame() { initComponents();//from w ww. j a va2 s . c om centerPanel = new GenericTestPanel(); jStatsPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jMainStatPanel); buildMenu(); capabilityInfoPanel1.addActionListener(this); KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false); KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); jTabbedPane1.registerKeyboardAction(DSWorkbenchStatsFrame.this, "BBCopy", bbCopy, JComponent.WHEN_IN_FOCUSED_WINDOW); jTribeList.registerKeyboardAction(DSWorkbenchStatsFrame.this, "Delete", delete, JComponent.WHEN_IN_FOCUSED_WINDOW); jAlwaysOnTopBox.setSelected(GlobalOptions.getProperties().getBoolean("stats.frame.alwaysOnTop")); setAlwaysOnTop(jAlwaysOnTopBox.isSelected()); jAllyList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { List allySelection = jAllyList.getSelectedValuesList(); jTribeList.clearSelection(); List<Tribe> tribes = new LinkedList<>(); for (Object o : allySelection) { Tribe[] tribesForAlly = StatManager.getSingleton().getMonitoredTribes((Ally) o); for (Tribe t : tribesForAlly) { if (!tribes.contains(t)) { tribes.add(t); } } Collections.sort(tribes); DefaultListModel<Tribe> model = new DefaultListModel<>(); for (Tribe t : tribes) { model.addElement(t); } jTribeList.setModel(model); } } }); jTribeList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { fireUpdateChartEvent(null); } }); Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); jStartDate.setDate(c.getTime()); jEndDate.setDate(c.getTime()); jStatCreatePanel.setVisible(false); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.stats_view", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> pack(); }
From source file:ee.ioc.cs.vsle.editor.Editor.java
/** * Build menu./* w ww .j a v a 2 s . c o m*/ */ public void makeMenu() { JMenuItem menuItem; JMenu menu; JMenu submenu; menuBar = new JMenuBar(); setJMenuBar(menuBar); menu = new JMenu(Menu.MENU_FILE); menu.setMnemonic(KeyEvent.VK_F); menuItem = new JMenuItem(Menu.NEW_SCHEME, KeyEvent.VK_N); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.LOAD_SCHEME, KeyEvent.VK_O); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.RELOAD_SCHEME, KeyEvent.VK_R); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.SAVE_SCHEME, KeyEvent.VK_S); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.SAVE_SCHEME_AS); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.DELETE_SCHEME, KeyEvent.VK_D); menuItem.addActionListener(getActionListener()); menu.add(menuItem); submenu = new JMenu(Menu.EXPORT_MENU); menu.add(submenu); //submenu.setMnemonic( KeyEvent.VK_E ); SchemeExporter.makeSchemeExportMenu(submenu, getActionListener()); // Export window graphics submenu.add(GraphicsExporter.getExportMenu()); menu.addSeparator(); menuItem = new JMenuItem(Menu.PRINT, KeyEvent.VK_P); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.EXIT, KeyEvent.VK_X); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuBar.add(menu); menu = new JMenu(Menu.MENU_EDIT); menu.setMnemonic(KeyEvent.VK_E); menu.add(undoAction); menu.add(redoAction); menu.add(cloneAction); menuItem = new JMenuItem(Menu.SCHEME_FIND, KeyEvent.VK_F); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.SELECT_ALL, KeyEvent.VK_A); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.CLEAR_ALL, KeyEvent.VK_C); menuItem.addActionListener(getActionListener()); menu.add(menuItem); final JCheckBoxMenuItem painterEnabled = new JCheckBoxMenuItem(Menu.CLASSPAINTER, true); painterEnabled.addActionListener(getActionListener()); menu.add(painterEnabled); menu.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { Canvas canvas = Editor.getInstance().getCurrentCanvas(); if (canvas == null || !canvas.getPackage().hasPainters()) { painterEnabled.setVisible(false); } else { painterEnabled.setVisible(true); painterEnabled.setSelected(canvas.isEnableClassPainter()); } } }); menuBar.add(menu); menu = new JMenu(Menu.MENU_VIEW); menu.setMnemonic(KeyEvent.VK_V); gridCheckBox = new JCheckBoxMenuItem(Menu.GRID, RuntimeProperties.isShowGrid()); gridCheckBox.setMnemonic('G'); gridCheckBox.addActionListener(getActionListener()); menu.add(gridCheckBox); ctrlCheckBox = new JCheckBoxMenuItem(Menu.CONTROL_PANEL, RuntimeProperties.isShowControls()); ctrlCheckBox.setMnemonic('C'); ctrlCheckBox.addActionListener(getActionListener()); menu.add(ctrlCheckBox); showPortCheckBox = new JCheckBoxMenuItem(Menu.SHOW_PORTS, true); showPortCheckBox.addActionListener(getActionListener()); menu.add(showPortCheckBox); showObjectNamesCheckBox = new JCheckBoxMenuItem(Menu.SHOW_NAMES, false); showObjectNamesCheckBox.addActionListener(getActionListener()); menu.add(showObjectNamesCheckBox); //sync View with current canvas menu.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { Canvas canvas; if ((canvas = getCurrentCanvas()) == null) return; gridCheckBox.setSelected(canvas.isGridVisible()); ctrlCheckBox.setSelected(canvas.isCtrlPanelVisible()); showPortCheckBox.setSelected(canvas.isDrawPorts()); showObjectNamesCheckBox.setSelected(canvas.isShowObjectNames()); } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } }); menuBar.add(menu); menu = new JMenu(Menu.MENU_PACKAGE); menu.setMnemonic(KeyEvent.VK_P); menuItem = new JMenuItem(Menu.LOAD, KeyEvent.VK_L); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.RELOAD, KeyEvent.VK_R); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.INFO, KeyEvent.VK_I); menuItem.addActionListener(getActionListener()); menu.add(menuItem); if (Desktop.isDesktopSupported()) { menuItem = new JMenuItem(Menu.BROWSE_PACKAGE, KeyEvent.VK_B); menuItem.addActionListener(getActionListener()); menu.add(menuItem); } menuItem = new JMenuItem(Menu.CLOSE, KeyEvent.VK_C); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.CLOSE_ALL); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuBar.add(menu); menu.add(new JSeparator()); final JMenu submenuRecent = new JMenu(Menu.RECENT); submenuRecent.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { final JMenuItem empty = new JMenuItem("Empty"); @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { makeRecentSubMenu(submenuRecent); if (submenuRecent.getMenuComponentCount() == 0) { submenuRecent.add(empty); empty.setEnabled(false); } else { if (!((submenuRecent.getMenuComponentCount() == 1) && (submenuRecent.getPopupMenu().getComponentIndex(empty) >= -1))) { submenuRecent.remove(empty); } } } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } }); menu.add(submenuRecent); final JMenu menuScheme = new JMenu(Menu.MENU_SCHEME); menuScheme.setMnemonic(KeyEvent.VK_S); makeSchemeMenu(menuScheme); menuScheme.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { makeSchemeMenu(menuScheme); } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } }); /* * menuItem = new JMenuItem("Planner"); * menuItem.addActionListener(aListener); menuScheme.add(menuItem); * menuItem = new JMenuItem("Plan, compile, run"); * menuItem.setActionCommand("Run"); * menuItem.addActionListener(aListener); menuScheme.add(menuItem); */ // menuScheme.setMnemonic(KeyEvent.VK_A); menuBar.add(menuScheme); menu = new JMenu(Menu.MENU_OPTIONS); menu.setMnemonic(KeyEvent.VK_O); menuItem = new JMenuItem(Menu.SETTINGS, KeyEvent.VK_S); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.FONTS); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.SAVE_SETTINGS); menuItem.addActionListener(getActionListener()); menu.add(menuItem); submenu = new JMenu(Menu.MENU_LAF); submenu.setMnemonic(KeyEvent.VK_L); Look.getInstance().createMenuItems(submenu); menu.add(submenu); menuBar.add(menu); makeToolsMenu(menuBar); menu = new JMenu(Menu.MENU_HELP); menu.setMnemonic(KeyEvent.VK_H); menuBar.add(menu); menuItem = new JMenuItem(Menu.DOCS, KeyEvent.VK_D); menuItem.addActionListener(getActionListener()); menu.add(menuItem); }
From source file:com.eviware.soapui.support.Tools.java
public static String modifyUrl(final String url, Integer mods) { String helpUrl = url;/*from www. j av a 2 s.c o m*/ // Integer, since switch strings won't work yet. int modifier = 0; // String modifier = "prod"; if (helpUrl == null) { modifier = 1; // "missing"; } else if (url.substring(0, 4).equals("http")) { modifier = 2; // "external"; } else if (((mods & ActionEvent.SHIFT_MASK) != 0) && ((mods & ActionEvent.CTRL_MASK) != 0)) { modifier = 3; // "dev"; } else if (((mods & ActionEvent.SHIFT_MASK) != 0) && ((mods & ActionEvent.ALT_MASK) != 0)) { modifier = 4; // "next"; } else { modifier = 0; // String modifier = "prod"; } switch (modifier) { case 1: // "missing": UISupport.showErrorMessage("Missing help URL"); helpUrl = HelpUrls.MISSING_URL + url; break; case 2: // "external": helpUrl = url; break; case 3: // "dev": helpUrl = HelpUrls.BASE_URL_DEV + url; break; case 4: // "next": helpUrl = HelpUrls.BASE_URL_NEXT + url; break; default: helpUrl = HelpUrls.BASE_URL_PROD + url; break; } return helpUrl; }
From source file:de.tor.tribes.ui.views.DSWorkbenchSOSRequestAnalyzer.java
/** * Creates new form DSWorkbenchSOSRequestAnalyzer *//*w w w . j a v a2 s . c o m*/ DSWorkbenchSOSRequestAnalyzer() { initComponents(); centerPanel = new GenericTestPanel(true); jSOSPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jSOSInputPanel); buildMenu(); jButton1.setIcon(new ImageIcon("./graphics/big/find.png")); capabilityInfoPanel1.addActionListener(DSWorkbenchSOSRequestAnalyzer.this); // KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK, false); KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false); KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); //KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK, false); // jAttacksTable.registerKeyboardAction(DSWorkbenchSOSRequestAnalyzer.this, "Copy", copy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttacksTable.registerKeyboardAction(DSWorkbenchSOSRequestAnalyzer.this, "BBCopy", bbCopy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttacksTable.registerKeyboardAction(DSWorkbenchSOSRequestAnalyzer.this, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // jAttacksTable.registerKeyboardAction(DSWorkbenchSOSRequestAnalyzer.this, "Cut", cut, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttacksTable.getActionMap().put("find", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //ignore find } }); jAttacksTable.setModel(new DefenseToolModel()); jAttacksTable.setHighlighters( HighlighterFactory.createAlternateStriping(Constants.DS_ROW_A, Constants.DS_ROW_B)); jAttacksTable.getColumnExt("Tendenz").setCellRenderer(new TendencyTableCellRenderer()); jAttacksTable.getColumnExt("Status").setCellRenderer(new DefenseStatusTableCellRenderer()); //jAttacksTable.getColumnExt("Wall").setCellRenderer(new WallLevellCellRenderer()); jAttacksTable.getColumnExt("Verlustrate").setCellRenderer(new LossRatioTableCellRenderer()); jAttacksTable.setDefaultRenderer(Date.class, new DateCellRenderer()); jAttacksTable.setColumnControlVisible(false); jAttacksTable.setDefaultRenderer(Date.class, new DateCellRenderer()); jAttacksTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); jAttacksTable.requestFocus(); jSupportsTable.setModel(new SupportsModel()); jSupportsTable.setHighlighters( HighlighterFactory.createAlternateStriping(Constants.DS_ROW_A, Constants.DS_ROW_B)); jSupportsTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); jSupportsTable.setDefaultRenderer(Date.class, new ColoredDateCellRenderer()); jSupportsTable.setDefaultRenderer(Boolean.class, new CustomBooleanRenderer(CustomBooleanRenderer.LayoutStyle.SENT_NOTSENT)); new SupportCountdownThread().start(); new SupportColorUpdateThread().start(); jXInfoLabel.setLineWrap(true); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.sos_analyzer", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> }
From source file:de.tor.tribes.ui.views.DSWorkbenchTagFrame.java
/** Creates new form DSWorkbenchTagFrame */ DSWorkbenchTagFrame() {/*from www.ja v a 2 s . c o m*/ initComponents(); centerPanel = new GenericTestPanel(); jTagPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jTagsPanel); buildMenu(); capabilityInfoPanel1.addActionListener(this); jTagsTable.setModel(new TagTableModel()); jTagsTable.getSelectionModel().addListSelectionListener(DSWorkbenchTagFrame.this); jTagsTable.getActionMap().put("find", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //ignore find } }); KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK, false); KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false); KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); jTagsTable.registerKeyboardAction(DSWorkbenchTagFrame.this, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jTagsTable.registerKeyboardAction(DSWorkbenchTagFrame.this, "BBCopy", bbCopy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jVillageList.registerKeyboardAction(DSWorkbenchTagFrame.this, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jVillageList.registerKeyboardAction(DSWorkbenchTagFrame.this, "BBCopy_Village", bbCopy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jTagsTable.registerKeyboardAction(DSWorkbenchTagFrame.this, "Paste", paste, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.tag_view", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> initialize(); pack(); }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
/** * Creates new form DSWorkbenchSelectionFrame *//* w w w . j a v a 2 s. co m*/ DSWorkbenchSelectionFrame() { initComponents(); centerPanel = new GenericTestPanel(true); jSelectionPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jSelectionTreePanel); buildMenu(); capabilityInfoPanel1.addActionListener(this); treeData = new LinkedList<>(); jSelectionTree.setCellRenderer(new NodeCellRenderer()); KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK, false); KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false); KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK, false); KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK, false); jSelectionTree.registerKeyboardAction(DSWorkbenchSelectionFrame.this, "Copy", copy, JComponent.WHEN_FOCUSED); jSelectionTree.registerKeyboardAction(DSWorkbenchSelectionFrame.this, "BBCopy", bbCopy, JComponent.WHEN_FOCUSED); jSelectionTree.registerKeyboardAction(DSWorkbenchSelectionFrame.this, "Delete", delete, JComponent.WHEN_FOCUSED); jSelectionTree.registerKeyboardAction(DSWorkbenchSelectionFrame.this, "Paste", paste, JComponent.WHEN_FOCUSED); jSelectionTree.registerKeyboardAction(DSWorkbenchSelectionFrame.this, "Cut", cut, JComponent.WHEN_FOCUSED); jSelectionTree.getActionMap().put("find", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //ignore find } }); jSelectionTree.getSelectionModel().addTreeSelectionListener(DSWorkbenchSelectionFrame.this); buildTree(); //<editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.selection_tool", GlobalOptions.getHelpBroker().getHelpSet()); } //</editor-fold> }
From source file:de.tor.tribes.ui.views.DSWorkbenchDoItYourselfAttackPlaner.java
/** * Creates new form DSWorkbenchDoItYourselflAttackPlaner *//*from w ww. ja v a 2 s.c o m*/ DSWorkbenchDoItYourselfAttackPlaner() { initComponents(); jAttackTable.setModel(new DoItYourselfAttackTableModel()); jAttackTable.getSelectionModel().addListSelectionListener(DSWorkbenchDoItYourselfAttackPlaner.this); jArriveTime.setDate(Calendar.getInstance().getTime()); jNewArriveSpinner.setDate(Calendar.getInstance().getTime()); capabilityInfoPanel1.addActionListener(this); KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK, false); KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false); KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK, false); KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK, false); KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); jAttackTable.registerKeyboardAction(DSWorkbenchDoItYourselfAttackPlaner.this, "Copy", copy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttackTable.registerKeyboardAction(DSWorkbenchDoItYourselfAttackPlaner.this, "Cut", cut, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttackTable.registerKeyboardAction(DSWorkbenchDoItYourselfAttackPlaner.this, "Paste", paste, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttackTable.registerKeyboardAction(DSWorkbenchDoItYourselfAttackPlaner.this, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttackTable.registerKeyboardAction(DSWorkbenchDoItYourselfAttackPlaner.this, "BBCopy", bbCopy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jAttackTable.getActionMap().put("find", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //no find } }); DoItYourselfCountdownThread thread = new DoItYourselfCountdownThread(); thread.start(); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.manual_attack_planer", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> pack(); }