List of usage examples for java.awt.event KeyEvent VK_DELETE
int VK_DELETE
To view the source code for java.awt.event KeyEvent VK_DELETE.
Click Source Link
From source file:org.tinymediamanager.ui.tvshows.TvShowPanel.java
/** * Builds the menu.//from w w w . java 2s. c o m */ private void buildMenu() { menu.setMnemonic(KeyEvent.VK_V); // menu items JMenuItem menuItem = menu.add(actionUpdateDatasources2); menuItem.setMnemonic(KeyEvent.VK_U); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menu.addSeparator(); JMenu menuScrape = new JMenu(BUNDLE.getString("Button.scrape")); //$NON-NLS-1$ menuScrape.setMnemonic(KeyEvent.VK_S); menuItem = menuScrape.add(actionScrape2); menuItem.setMnemonic(KeyEvent.VK_S); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuScrape.add(actionScrapeSelected); menuItem.setMnemonic(KeyEvent.VK_F); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuScrape.add(actionScrapeNewItems); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menu.add(menuScrape); JMenu menuEdit = new JMenu(BUNDLE.getString("Button.edit")); //$NON-NLS-1$ menuEdit.setMnemonic(KeyEvent.VK_E); menuItem = menuEdit.add(actionEdit2); menuItem.setMnemonic(KeyEvent.VK_E); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuEdit.add(actionBatchEdit); menuItem.setMnemonic(KeyEvent.VK_B); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuEdit.add(actionSetWatchedFlag); menuItem.setMnemonic(KeyEvent.VK_W); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuEdit.add(actionChangeSeasonPoster2); menuItem.setMnemonic(KeyEvent.VK_S); menuEdit.add(actionChangeToDvdOrder); menuEdit.add(actionChangeToAiredOrder); menu.add(menuEdit); menu.add(actionRewriteTvShowNfo); menu.add(actionRewriteTvShowEpisodeNfo); menuItem = menu.add(actionRename); menuItem.setMnemonic(KeyEvent.VK_R); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menu.add(actionMediaInformation2); menuItem.setMnemonic(KeyEvent.VK_M); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menu.add(actionExport); menuItem.setMnemonic(KeyEvent.VK_X); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menu.add(actionClearImageCache); menuItem.setMnemonic(KeyEvent.VK_C); menu.addSeparator(); menuItem = menu.add(actionRemove2); menuItem.setAccelerator(KeyStroke.getKeyStroke((char) KeyEvent.VK_DELETE)); menuItem = menu.add(actionDelete2); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, ActionEvent.SHIFT_MASK)); menu.addSeparator(); menuItem = menu.add(actionSyncTrakt); menuItem.setMnemonic(KeyEvent.VK_T); menuItem = menu.add(actionSyncWatchedTrakt); menuItem.setMnemonic(KeyEvent.VK_W); menuItem = menu.add(actionSyncSelectedTrakt); // popup menu JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(actionScrape2); popupMenu.add(actionScrapeSelected); popupMenu.add(actionScrapeEpisodes); popupMenu.add(actionScrapeEpisodes2); popupMenu.add(actionScrapeNewItems); // popupMenu.add(actionScrapeMetadataSelected); popupMenu.addSeparator(); popupMenu.add(actionUpdateTvShow); popupMenu.addSeparator(); popupMenu.add(actionEdit2); popupMenu.add(actionChangeSeasonPoster2); popupMenu.add(actionBatchEdit); popupMenu.add(actionSetWatchedFlag); popupMenu.add(actionChangeToDvdOrder); popupMenu.add(actionChangeToAiredOrder); popupMenu.add(actionRewriteTvShowNfo); popupMenu.add(actionRewriteTvShowEpisodeNfo); // popupMenu.add(actionBatchEdit); popupMenu.add(actionRename); popupMenu.add(actionMediaInformation2); popupMenu.add(actionExport); popupMenu.add(actionClearImageCache); popupMenu.addSeparator(); popupMenu.add(actionDownloadSubtitles); popupMenu.add(actionSearchAndDownloadSubtitles); popupMenu.addSeparator(); popupMenu.add(actionSyncTrakt); popupMenu.add(actionSyncWatchedTrakt); popupMenu.add(actionSyncSelectedTrakt); popupMenu.addSeparator(); popupMenu.add(actionRemove2); popupMenu.add(actionDelete2); popupMenu.addSeparator(); popupMenu.add(new ExpandAllAction()); popupMenu.add(new CollapseAllAction()); if (Globals.isDebug()) { JMenu menuDebug = new JMenu("Debug"); //$NON-NLS-1$ menuDebug.add(debugDumpShow); popupMenu.addSeparator(); popupMenu.add(menuDebug); } MouseListener popupListener = new TreePopupListener(popupMenu, tree); tree.addMouseListener(popupListener); }
From source file:org.yccheok.jstock.gui.JStock.java
private void jTable1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyPressed if (KeyEvent.VK_DELETE == evt.getKeyCode()) { this.deteleSelectedTableRow(); return;//from w w w . j ava 2 s .c o m } else if (KeyEvent.VK_ENTER == evt.getKeyCode()) { displayHistoryCharts(); return; } else if (evt.isActionKey()) { int[] rows = JStock.this.jTable1.getSelectedRows(); if (rows.length == 1) { int row = rows[0]; final StockTableModel tableModel = (StockTableModel) jTable1.getModel(); final int modelIndex = jTable1.convertRowIndexToModel(row); final Stock stock = tableModel.getStock(modelIndex); this.updateDynamicChart(stock); } else { this.updateDynamicChart(null); } } }
From source file:org.yccheok.jstock.gui.MainFrame.java
private void jTable1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyPressed if (KeyEvent.VK_DELETE == evt.getKeyCode()) { this.deteleSelectedTableRow(); return;/*from w w w . j av a 2 s.c o m*/ } if (evt.isActionKey()) { int[] rows = MainFrame.this.jTable1.getSelectedRows(); if (rows.length == 1) { int row = rows[0]; final StockTableModel tableModel = (StockTableModel) jTable1.getModel(); final int modelIndex = jTable1.convertRowIndexToModel(row); final Stock stock = tableModel.getStock(modelIndex); this.updateDynamicChart(stock); } else { this.updateDynamicChart(null); } } }
From source file:org.yccheok.jstock.gui.portfolio.DividendSummaryJDialog.java
private void jTable1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyPressed if (KeyEvent.VK_DELETE == evt.getKeyCode()) { this.deleteSelectedDividend(); this.jLabel2.setText(this.getDividendSummaryText()); return;/* w w w. ja v a 2 s .c o m*/ } }
From source file:org.yccheok.jstock.gui.StockDatabaseJDialog.java
private void jTable2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable2KeyPressed if (KeyEvent.VK_DELETE == evt.getKeyCode()) { this.deleteSelectedUserDefinedDatabase(); }/*from w w w .j a v a 2 s .c om*/ }
From source file:pl.otros.logview.gui.message.editor.MessageColorizerBrowser.java
public MessageColorizerBrowser(OtrosApplication otrosApplication) { super(new BorderLayout()); this.container = otrosApplication.getAllPluginables().getMessageColorizers(); this.otrosApplication = otrosApplication; toolBar = new JToolBar(); editor = new MessageColorizerEditor(container, otrosApplication.getStatusObserver()); JLabel noEditable = new JLabel("Selected MessageColorizer is not editable.", SwingConstants.CENTER); JLabel nothingSelected = new JLabel("Nothing selected", SwingConstants.CENTER); listModel = new PluginableElementListModel<MessageColorizer>(container); jList = new JList(listModel); jList.setCellRenderer(new PluginableElementNameListRenderer()); cardLayout = new CardLayout(); contentPanel = new JPanel(cardLayout); contentPanel.add(editor, CARD_LAYOUT_EDITOR); contentPanel.add(noEditable, CARD_LAYOUT_NOT_EDITABLE); contentPanel.add(nothingSelected, CARD_LAYOUT_NO_SELECTED); cardLayout.show(contentPanel, CARD_LAYOUT_NOT_EDITABLE); JSplitPane mainSplitPane = new JSplitPane(SwingConstants.VERTICAL, new JScrollPane(jList), contentPanel); mainSplitPane.setDividerLocation(220); jList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override/*from www . j a v a 2 s. c o m*/ public void valueChanged(ListSelectionEvent e) { showSelected(); enableDisableButtonsForSelectedColorizer(); } }); jList.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_DELETE) { ActionEvent actionEvent = new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, ""); deleteAction.actionPerformed(actionEvent); } } }); JButton createNew = new JButton("Create new", Icons.ADD); createNew.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveAsButton.setEnabled(false); createNew(); } }); saveButton = new JButton("Save and use", Icons.DISK); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { PropertyPatternMessageColorizer mc = editor.createMessageColorizer(); File selectedFile = null; String f = mc.getFile(); if (StringUtils.isNotBlank(f)) { selectedFile = new File(mc.getFile()); } else { int response = chooser.showSaveDialog(MessageColorizerBrowser.this); if (response != JFileChooser.APPROVE_OPTION) { return; } selectedFile = chooser.getSelectedFile(); if (!selectedFile.getName().endsWith(".pattern")) { selectedFile = new File(selectedFile.getParentFile(), selectedFile.getName() + ".pattern"); } } removeMessageColorizerWithNullFile(); applyMessageColorizer(selectedFile); saveMessageColorizer(selectedFile); jList.setSelectedValue(mc, true); } catch (ConfigurationException e1) { String errorMessage = String.format("Can't save message colorizer: %s", e1.getMessage()); LOGGER.severe(errorMessage); MessageColorizerBrowser.this.otrosApplication.getStatusObserver().updateStatus(errorMessage, StatusObserver.LEVEL_ERROR); } } }); saveAsButton = new JButton("Save as", Icons.DISK_PLUS); saveAsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { int response = chooser.showSaveDialog(MessageColorizerBrowser.this); if (response != JFileChooser.APPROVE_OPTION) { return; } File selectedFile = chooser.getSelectedFile(); selectedFile = chooser.getSelectedFile(); if (!selectedFile.getName().endsWith(".pattern")) { selectedFile = new File(selectedFile.getParentFile(), selectedFile.getName() + ".pattern"); } removeMessageColorizerWithNullFile(); applyMessageColorizer(selectedFile); saveMessageColorizer(selectedFile); jList.setSelectedValue(editor.createMessageColorizer(), true); } catch (ConfigurationException e1) { String errorMessage = String.format("Can't save message colorizer: %s", e1.getMessage()); LOGGER.severe(errorMessage); MessageColorizerBrowser.this.otrosApplication.getStatusObserver().updateStatus(errorMessage, StatusObserver.LEVEL_ERROR); } } }); useButton = new JButton("Use without saving"); useButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { try { removeMessageColorizerWithNullFile(); applyMessageColorizer(File.createTempFile("messageColorizer", "pattern")); } catch (Exception e) { LOGGER.severe("Cannot create message colorizer: " + e.getMessage()); } } }); deleteAction = new DeleteSelected(otrosApplication); deleteButton = new JButton(deleteAction); toolBar.setFloatable(false); toolBar.add(createNew); toolBar.add(saveButton); toolBar.add(saveAsButton); toolBar.add(useButton); toolBar.add(deleteButton); enableDisableButtonsForSelectedColorizer(); initFileChooser(); this.add(mainSplitPane); this.add(toolBar, BorderLayout.SOUTH); }
From source file:plugin.notes.gui.JIcon.java
private void buttonKeyReleased(KeyEvent evt) { int key = evt.getKeyCode(); if (key == KeyEvent.VK_DELETE) { deleteFile();//w w w . j a v a 2 s.c o m } else if (key == KeyEvent.VK_ENTER) { launchFile(); } }
From source file:processing.app.syntax.SketchTextArea.java
private void fixCtrlDeleteBehavior() { int modifier = OSUtils.isMacOS() ? InputEvent.ALT_MASK : InputEvent.CTRL_MASK; KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, modifier); getInputMap().put(keyStroke, SketchTextAreaEditorKit.rtaDeleteNextWordAction); }
From source file:pt.ua.dicoogle.rGUI.client.windows.MainWindow.java
private void jTreeResultsKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTreeResultsKeyReleased if (KeyEvent.VK_DELETE == evt.getKeyCode() && clientCore.isAdmin()) { ArrayList<String> files = getSelectedLocalFiles(); if (files != null && !files.isEmpty()) { try { Object[] opt = { "Remove and Delete", "Remove", "Cancel" }; String message = "Are you sure you want to remove these files from Index Engine?"; int op = JOptionPane.showOptionDialog(this, message, "Remove Files", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, opt, opt[2]); if (op == 0) { AdminRefs.getInstance().getIndexOptions().removeFilesFromIndexer(files, true); }// w w w. j av a 2 s . com if (op == 1) { AdminRefs.getInstance().getIndexOptions().removeFilesFromIndexer(files, false); } } catch (RemoteException ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); } } } }
From source file:ropes.MainWindow.java
private void jTextField_sliderValueKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_sliderValueKeyTyped char c = evt.getKeyChar(); String txtVal = jTextField_sliderValue.getText(); if (txtVal.equals("") && (c == KeyEvent.VK_BACK_SPACE || c == KeyEvent.VK_DELETE)) { evt.consume();/*from ww w .j a v a 2s. co m*/ return; } if (!"".equals(txtVal)) { if (!(Character.isDigit(c) || c == KeyEvent.VK_BACK_SPACE || c == KeyEvent.VK_DELETE) || jSlider_size_select.getMaximum() <= Integer.valueOf(txtVal)) { evt.consume(); } else { if (Integer.valueOf(txtVal) == 0) jTextField_sliderValue.setText(""); } } //Integer textFieldVal = Integer.valueOf(jTextField_sliderValue.getText()); // jSlider_size_select.setValue(WIDTH); }