List of usage examples for java.awt.event ActionEvent ActionEvent
public ActionEvent(Object source, int id, String command)
From source file:org.apache.jmeter.gui.MainFrame.java
/** * Handles click on warnIndicator/*from w ww .j ava 2 s. c om*/ */ @Override public void actionPerformed(ActionEvent event) { if (event.getSource() == warnIndicator) { ActionRouter.getInstance().doActionNow( new ActionEvent(event.getSource(), event.getID(), ActionNames.LOGGER_PANEL_ENABLE_DISABLE)); } }
From source file:net.sf.jabref.gui.entryeditor.EntryEditor.java
/** * Makes sure the current edit is stored. *///from w w w.j av a 2 s .c o m public void storeCurrentEdit() { Component comp = Globals.getFocusListener().getFocused(); if (Objects.equals(comp, source) || ((comp instanceof FieldEditor) && this.isAncestorOf(comp))) { if (comp instanceof FieldEditor) { ((FieldEditor) comp).clearAutoCompleteSuggestion(); } getStoreFieldAction().actionPerformed(new ActionEvent(comp, 0, "")); } }
From source file:org.photovault.swingui.PhotoCollectionThumbView.java
/** * On mouse click select the photo clicked. * * @param mouseEvent a <code>MouseEvent</code> value *///from w ww. j a v a2 s . c om public void mouseClicked(MouseEvent mouseEvent) { log.debug("mouseClicked (" + mouseEvent.getX() + ", " + mouseEvent.getY()); if (dragJustEnded) { // Selection was already handled by drag handler so do nothing dragJustEnded = false; return; } PhotoInfo clickedPhoto = getPhotoAtLocation(mouseEvent.getX(), mouseEvent.getY()); if (clickedPhoto != null) { if (mouseEvent.isControlDown()) { photoClickedCtrlDown(clickedPhoto); } else { photoClickedNoModifiers(clickedPhoto); } // If this was a doublke click open the selected photo(s) if (mouseEvent.getClickCount() == 2) { showSelectedPhotoAction.actionPerformed(new ActionEvent(this, 0, null)); } } else { // The click was between photos. Clear the selection if (!mouseEvent.isControlDown()) { Object[] oldSelection = selection.toArray(); selection.clear(); fireSelectionChangeEvent(); for (int n = 0; n < oldSelection.length; n++) { PhotoInfo photo = (PhotoInfo) oldSelection[n]; repaintPhoto(photo); } } } repaintPhoto(clickedPhoto); }
From source file:op.tools.SYSTools.java
public static BigDecimal checkBigDecimal(javax.swing.event.CaretEvent evt, boolean nees2BePositive) { BigDecimal bd = null;// ww w . j av a 2 s .co m JTextComponent txt = (JTextComponent) evt.getSource(); Action toolTipAction = txt.getActionMap().get("hideTip"); if (toolTipAction != null) { ActionEvent hideTip = new ActionEvent(txt, ActionEvent.ACTION_PERFORMED, ""); toolTipAction.actionPerformed(hideTip); } try { OPDE.debug(txt.getText()); OPDE.debug(assimilateDecimalSeparators(txt.getText())); bd = parseDecimal(txt.getText()); // bd = BigDecimal.valueOf(Double.parseDouble(assimilateDecimalSeparators(txt.getText()))); OPDE.debug(bd); if (nees2BePositive && bd.compareTo(BigDecimal.ZERO) <= 0) { txt.setToolTipText("<html><font color=\"red\"><b>" + SYSTools.xx("misc.msg.invalidnumber") + "</b></font></html>"); toolTipAction = txt.getActionMap().get("postTip"); bd = BigDecimal.ONE; } else { txt.setToolTipText(""); } } catch (NumberFormatException ex) { if (nees2BePositive) { bd = BigDecimal.ONE; } else { bd = BigDecimal.ZERO; } txt.setToolTipText( "<html><font color=\"red\"><b>" + SYSTools.xx("misc.msg.invalidnumber") + "</b></font></html>"); toolTipAction = txt.getActionMap().get("postTip"); if (toolTipAction != null) { ActionEvent postTip = new ActionEvent(txt, ActionEvent.ACTION_PERFORMED, ""); toolTipAction.actionPerformed(postTip); } } return bd; }
From source file:net.sf.jabref.gui.entryeditor.EntryEditor.java
public void updateField(final Object sourceObject) { getStoreFieldAction().actionPerformed(new ActionEvent(sourceObject, 0, "")); }
From source file:pl.otros.vfs.browser.VfsBrowser.java
License:asdf
public void setApproveAction(Action action) { actionApproveDelegate = action;//from w ww . j av a2 s. c o m actionApproveButton.setAction(actionApproveDelegate); if (action != null) { actionApproveButton .setText(String.format("%s [Ctrl+Enter]", actionApproveDelegate.getValue(Action.NAME))); } if (targetFileSelected) { actionApproveDelegate.actionPerformed( // TODO: Does actionResult provide an ID for 2nd param here, // or should use a Random number? new ActionEvent(action, (int) new java.util.Date().getTime(), "SELECTED_FILE")); } else try { selectionChanged(); } catch (FileSystemException e) { LOGGER.warn("Problem with checking selection conditions", e); } }
From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java
/** * Sets the font family and size/*from ww w . java 2 s. co m*/ * @param family the family name * @param size the size */ public void setFontFamilyAndSize(String family, int size) { // Family ActionEvent evt = new ActionEvent(editorPane, ActionEvent.ACTION_PERFORMED, family); Action action = new StyledEditorKit.FontFamilyAction(family, family); action.actionPerformed(evt); // Size evt = new ActionEvent(editorPane, ActionEvent.ACTION_PERFORMED, Integer.toString(size)); action = new StyledEditorKit.FontSizeAction(Integer.toString(size), size); action.actionPerformed(evt); }
From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java
/** * Sets the font color// w w w . jav a2 s .com * @param color the color */ public void setFontColor(Color color) { ActionEvent evt = new ActionEvent(editorPane, ActionEvent.ACTION_PERFORMED, ""); Action action = new HTMLEditorKit.ForegroundAction(Integer.toString(color.getRGB()), color); action.actionPerformed(evt); }
From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java
/** * Sets the given style constant.//from www. j a va 2 s . c o m * * @param action the action * @param styleConstant the style constant */ private void setStyleConstant(Action action, Object styleConstant) { ActionEvent event = new ActionEvent(editorPane, ActionEvent.ACTION_PERFORMED, styleConstant.toString()); action.actionPerformed(event); }