List of usage examples for java.awt.event KeyEvent VK_B
int VK_B
To view the source code for java.awt.event KeyEvent VK_B.
Click Source Link
From source file:MenuSelectionManagerDemo.java
public JMenuBar createMenuBar() { JMenuBar menuBar;/* ww w.j av a2 s .co m*/ JMenu menu, submenu; JMenuItem menuItem; JRadioButtonMenuItem rbMenuItem; JCheckBoxMenuItem cbMenuItem; //Create the menu bar. menuBar = new JMenuBar(); //Build the first menu. menu = new JMenu("A Menu"); menu.setMnemonic(KeyEvent.VK_A); menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items"); menuBar.add(menu); //a group of JMenuItems menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T); //menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything"); menuItem.addActionListener(this); menu.add(menuItem); ImageIcon icon = createImageIcon("1.gif"); menuItem = new JMenuItem("Both text and icon", icon); menuItem.setMnemonic(KeyEvent.VK_B); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem(icon); menuItem.setMnemonic(KeyEvent.VK_D); menuItem.addActionListener(this); menu.add(menuItem); //a group of radio button menu items menu.addSeparator(); ButtonGroup group = new ButtonGroup(); rbMenuItem = new JRadioButtonMenuItem("A radio button menu item"); rbMenuItem.setSelected(true); rbMenuItem.setMnemonic(KeyEvent.VK_R); group.add(rbMenuItem); rbMenuItem.addActionListener(this); menu.add(rbMenuItem); rbMenuItem = new JRadioButtonMenuItem("Another one"); rbMenuItem.setMnemonic(KeyEvent.VK_O); group.add(rbMenuItem); rbMenuItem.addActionListener(this); menu.add(rbMenuItem); //a group of check box menu items menu.addSeparator(); cbMenuItem = new JCheckBoxMenuItem("A check box menu item"); cbMenuItem.setMnemonic(KeyEvent.VK_C); cbMenuItem.addItemListener(this); menu.add(cbMenuItem); cbMenuItem = new JCheckBoxMenuItem("Another one"); cbMenuItem.setMnemonic(KeyEvent.VK_H); cbMenuItem.addItemListener(this); menu.add(cbMenuItem); //a submenu menu.addSeparator(); submenu = new JMenu("A submenu"); submenu.setMnemonic(KeyEvent.VK_S); menuItem = new JMenuItem("An item in the submenu"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK)); menuItem.addActionListener(this); submenu.add(menuItem); menuItem = new JMenuItem("Another item"); menuItem.addActionListener(this); submenu.add(menuItem); menu.add(submenu); //Build second menu in the menu bar. menu = new JMenu("Another Menu"); menu.setMnemonic(KeyEvent.VK_N); menu.getAccessibleContext().setAccessibleDescription("This menu does nothing"); menuBar.add(menu); Timer timer = new Timer(ONE_SECOND, new ActionListener() { public void actionPerformed(ActionEvent evt) { MenuElement[] path = MenuSelectionManager.defaultManager().getSelectedPath(); for (int i = 0; i < path.length; i++) { if (path[i].getComponent() instanceof javax.swing.JMenuItem) { JMenuItem mi = (JMenuItem) path[i].getComponent(); if ("".equals(mi.getText())) { output.append("ICON-ONLY MENU ITEM > "); } else { output.append(mi.getText() + " > "); } } } if (path.length > 0) output.append(newline); } }); timer.start(); return menuBar; }
From source file:de.tor.tribes.ui.views.DSWorkbenchFormFrame.java
/** Creates new form DSWorkbenchFormFrame */ DSWorkbenchFormFrame() {/*from w w w . j ava 2s .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.tor.tribes.ui.views.DSWorkbenchStatsFrame.java
DSWorkbenchStatsFrame() { initComponents();/*from w w w.j ava 2 s .c o m*/ 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:de.tor.tribes.ui.views.DSWorkbenchSOSRequestAnalyzer.java
/** * Creates new form DSWorkbenchSOSRequestAnalyzer *//*www .ja va 2 s .co 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:SwingMenus.java
public void init() { ML ml = new ML(); CMIL cmil = new CMIL(); safety[0].setActionCommand("Guard"); safety[0].setMnemonic(KeyEvent.VK_G); safety[0].addItemListener(cmil);//from w w w . j a v a 2 s . c o m safety[1].setActionCommand("Hide"); safety[1].setMnemonic(KeyEvent.VK_H); safety[1].addItemListener(cmil); other[0].addActionListener(new FooL()); other[1].addActionListener(new BarL()); other[2].addActionListener(new BazL()); FL fl = new FL(); for (int i = 0; i < flavors.length; i++) { JMenuItem mi = new JMenuItem(flavors[i]); mi.addActionListener(fl); m.add(mi); // Add separators at intervals: if ((i + 1) % 3 == 0) m.addSeparator(); } for (int i = 0; i < safety.length; i++) s.add(safety[i]); s.setMnemonic(KeyEvent.VK_A); f.add(s); f.setMnemonic(KeyEvent.VK_F); for (int i = 0; i < file.length; i++) { file[i].addActionListener(fl); f.add(file[i]); } mb1.add(f); mb1.add(m); setJMenuBar(mb1); t.setEditable(false); Container cp = getContentPane(); cp.add(t, BorderLayout.CENTER); // Set up the system for swapping menus: b.addActionListener(new BL()); b.setMnemonic(KeyEvent.VK_S); cp.add(b, BorderLayout.NORTH); for (int i = 0; i < other.length; i++) fooBar.add(other[i]); fooBar.setMnemonic(KeyEvent.VK_B); mb2.add(fooBar); }
From source file:de.tor.tribes.ui.views.DSWorkbenchTagFrame.java
/** Creates new form DSWorkbenchTagFrame */ DSWorkbenchTagFrame() {//www . j a 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:com.chenjw.imagegrab.ui.MainFrame.java
public MainFrame() { {// w w w . ja v a 2 s . c o m this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); } GroupLayout configPanelLayout = new GroupLayout((JComponent) configPanel); configPanel.setLayout(configPanelLayout); configPanel.setPreferredSize(new java.awt.Dimension(1035, 726)); { downloadButton = new JButton(); downloadButton.setText(""); downloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { executeService.execute(new Runnable() { @Override public void run() { imagegrabService.grab(); } }); } }); downloadButton.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { executeService.execute(new Runnable() { @Override public void run() { imagegrabService.grab(); } }); } }, KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); } { jLabel1 = new JLabel(); jLabel1.setText("??"); } { resultScrollPane = new JScrollPane(resultPane); { resultPane = new JTextArea(); resultScrollPane.setViewportView(resultPane); } } { sourceComboBox = new JComboBox(); } { maxNumComboBox = new HistoryComboBox("maxNum"); } { jLabel6 = new JLabel(); jLabel6.setText("??"); } { jLabel3 = new JLabel(); jLabel3.setText("??"); } { searchWordComboBox = new HistoryComboBox("searchWord"); } configPanelLayout.setHorizontalGroup(configPanelLayout.createSequentialGroup().addContainerGap() .addGroup(configPanelLayout.createParallelGroup() .addGroup(configPanelLayout.createSequentialGroup() .addComponent(resultScrollPane, GroupLayout.PREFERRED_SIZE, 979, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.LEADING, configPanelLayout.createSequentialGroup() .addPreferredGap(resultScrollPane, jLabel1, LayoutStyle.ComponentPlacement.INDENT) .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(searchWordComboBox, 0, 213, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE) .addComponent(sourceComboBox, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(maxNumComboBox, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(downloadButton, GroupLayout.PREFERRED_SIZE, 162, GroupLayout.PREFERRED_SIZE) .addGap(0, 164, GroupLayout.PREFERRED_SIZE))) .addContainerGap()); configPanelLayout.setVerticalGroup(configPanelLayout.createSequentialGroup().addContainerGap() .addGroup(configPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(searchWordComboBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(sourceComboBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(downloadButton, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(maxNumComboBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 698, GroupLayout.PREFERRED_SIZE) .addComponent(resultScrollPane, GroupLayout.PREFERRED_SIZE, 686, GroupLayout.PREFERRED_SIZE)); // pack(); this.setSize(1010, 768); setVisible(true); this.setTitle("?"); getContentPane().add(configPanel, BorderLayout.CENTER); initSpring(); }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
/** * Creates new form DSWorkbenchSelectionFrame *//* w w w . ja v a 2 s . c o 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 w w .j a v a 2s. c om 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(); }
From source file:de.tor.tribes.ui.views.DSWorkbenchReTimerFrame.java
/** Creates new form DSWorkbenchReTimerFrame */ DSWorkbenchReTimerFrame() {/*from w w w .j av a 2s. co m*/ initComponents(); centerPanel = new GenericTestPanel(true); jReTimePanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jideRetimeTabbedPane); jideRetimeTabbedPane.setTabShape(JideTabbedPane.SHAPE_OFFICE2003); jideRetimeTabbedPane.setTabColorProvider(JideTabbedPane.ONENOTE_COLOR_PROVIDER); jideRetimeTabbedPane.setBoldActiveTab(true); jideRetimeTabbedPane.addTab("Festlegen des Angriffs", jInputPanel); jideRetimeTabbedPane.addTab("Errechnete Gegenangriffe", jResultPanel); buildMenu(); 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 delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false); KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK, false); jResultTable.registerKeyboardAction(DSWorkbenchReTimerFrame.this, "Copy", copy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jResultTable.registerKeyboardAction(DSWorkbenchReTimerFrame.this, "BBCopy", bbCopy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jResultTable.registerKeyboardAction(DSWorkbenchReTimerFrame.this, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jResultTable.registerKeyboardAction(DSWorkbenchReTimerFrame.this, "Cut", cut, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); jResultTable.getActionMap().put("find", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { //ignore find } }); jCommandArea.setPrompt("<Angriffsbefehl hier einfgen>"); jResultTable.getSelectionModel().addListSelectionListener(DSWorkbenchReTimerFrame.this); jPossibleUnits.setCellRenderer(new UnitListCellRenderer()); jPossibleUnits.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateAttackBBView(); } } }); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.retime_tool", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> }