public void activate() { // arranco la primera opcion if (m_actionfirst != null) { m_actionfirst.actionPerformed(null); m_actionfirst = null; } }
public void actionPerformed(ActionEvent e) { int selIndexBefore = getSelectedIndex(); myDefaultAction.actionPerformed(e); int selIndexCurrent = getSelectedIndex(); if (selIndexBefore != selIndexCurrent) { return; } if (myFocusNext && selIndexCurrent == 0) { return; } KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Container container = kfm.getCurrentFocusCycleRoot(); FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); if (policy == null) { policy = kfm.getDefaultFocusTraversalPolicy(); } Component next = myFocusNext ? policy.getComponentAfter(container, PaletteItemsComponent.this) : policy.getComponentBefore(container, PaletteItemsComponent.this); if (next instanceof PaletteGroupComponent) { clearSelection(); next.requestFocus(); ((PaletteGroupComponent) next).scrollRectToVisible(next.getBounds()); } }
private boolean proceedKeyEvent(KeyEvent event, KeyStroke stroke) { if (myInputMap.get(stroke) != null) { final Action action = myActionMap.get(myInputMap.get(stroke)); if (action != null && action.isEnabled()) { action.actionPerformed( new ActionEvent( getContent(), event.getID(), "", event.getWhen(), event.getModifiers())); return true; } } return false; }
public void redoAction() { try { if (undoMgr.canRedo()) { redoAction.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Redo")); setRedoItem(); } else { java.awt.Toolkit.getDefaultToolkit().beep(); } } catch (CannotUndoException ex) { ex.printStackTrace(); } }
public void actionPerformed(ActionEvent e) { int selIndexBefore = getSelectedIndex(); myDefaultAction.actionPerformed(e); int selIndexCurrent = getSelectedIndex(); if (mySelectNext && selIndexBefore < selIndexCurrent || !mySelectNext && selIndexBefore > selIndexCurrent) { return; } if (mySelectNext) { if (selIndexCurrent == selIndexBefore + 1) { selIndexCurrent++; } if (selIndexCurrent < getModel().getSize() - 1) { setSelectedIndex(selIndexCurrent + 1); scrollRectToVisible(getCellBounds(selIndexCurrent + 1, selIndexCurrent + 1)); } } else if (selIndexCurrent > 0) { setSelectedIndex(selIndexCurrent - 1); scrollRectToVisible(getCellBounds(selIndexCurrent - 1, selIndexCurrent - 1)); } }
@SuppressWarnings("HardCodedStringLiteral") private void processListSelection(final KeyEvent e) { if (togglePopup(e)) return; if (!isPopupShowing()) return; final InputMap map = myPathTextField.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); if (map != null) { final Object object = map.get(KeyStroke.getKeyStrokeForEvent(e)); if (object instanceof Action) { final Action action = (Action) object; if (action.isEnabled()) { action.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "action")); e.consume(); return; } } } final Object action = getAction(e, myList); if ("selectNextRow".equals(action)) { if (ensureSelectionExists()) { ListScrollingUtil.moveDown(myList, e.getModifiersEx()); } } else if ("selectPreviousRow".equals(action)) { ListScrollingUtil.moveUp(myList, e.getModifiersEx()); } else if ("scrollDown".equals(action)) { ListScrollingUtil.movePageDown(myList); } else if ("scrollUp".equals(action)) { ListScrollingUtil.movePageUp(myList); } else if (getSelectedFileFromCompletionPopup() != null && (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_TAB) && e.getModifiers() == 0) { hideCurrentPopup(); e.consume(); processChosenFromCompletion(e.getKeyCode() == KeyEvent.VK_TAB); } }
public ConverterView(ConverterModel model) { // this.model = model; this.fileChooser = new JFileChooser(); this.fileChooser.setFileFilter(new ConverterFileFilter()); this.fileChooser.setMultiSelectionEnabled(true); setTitle(getGuiString(model.getName())); this.addButton = new JButton(getGuiString("buttons.change")); this.addButton.addActionListener( e -> { if (this.changeActionListener != null) { Action details = fileChooser.getActionMap().get("viewTypeDetails"); details.actionPerformed(null); if (FilePath.getFilePath(this.getTitle()) != null) { File file = new File(FilePath.getFilePath(this.getTitle()).getPath()); fileChooser.setCurrentDirectory(file); } int ret = fileChooser.showDialog(null, getGuiString("buttons.openFile")); if (ret == JFileChooser.APPROVE_OPTION) { File[] files = fileChooser.getSelectedFiles(); FilePath.setFilePath(this.getTitle(), fileChooser.getCurrentDirectory().getPath()); this.changeActionListener.actionPerformed(files); } } hide(); }); this.cancelButton = new JButton(getGuiString("buttons.cancel")); this.cancelButton.addActionListener( e -> { hide(); }); buildLayout(); show(); }
public void selectLine() { Action selectLine = getAction(DefaultEditorKit.selectLineAction); if (selectLine != null) { selectLine.actionPerformed(null); } }
public void actionPerformed(ActionEvent event) { saveHistoryAction.actionPerformed(event); }
public void actionPerformed(ActionEvent event) { stopRAction.actionPerformed(event); }
public void actionPerformed(ActionEvent e) { String keyword = EditorUtil.getSelectedkeyword(logArea); if (keyword != null) { openfunctionAction.actionPerformed(new ActionEvent(this, 0, keyword)); } }
public void actionPerformed(ActionEvent event) { String keyword = EditorUtil.getSelectedkeyword(logArea); if (keyword != null) { requesthelpAction.actionPerformed(new ActionEvent(this, 0, keyword)); } }