@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { closeAction.actionPerformed(new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null, EventQueue.getMostRecentEventTime(), e.getModifiers())); } } });
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { closeAction.actionPerformed(new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null, EventQueue.getMostRecentEventTime(), e.getModifiers())); } } });
private void fireActionPerformed(ComboBoxEditor source) { actionPerformed(new ActionEvent(source, 0, "", EventQueue.getMostRecentEventTime(), 0)); }
private void fireActionPerformed(ComboBoxEditor source) { actionPerformed(new ActionEvent(source, 0, "", EventQueue.getMostRecentEventTime(), 0)); }
/** * Notifies all listeners that have registered interest for * notification on this event type. The event instance * is lazily created. * The listener list is processed in last to * first order. */ protected void fireActionPerformed() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); ActionEvent e = new ActionEvent( this, ActionEvent.ACTION_PERFORMED, getText(), EventQueue.getMostRecentEventTime(), 0); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==ActionListener.class) { ((ActionListener)listeners[i+1]).actionPerformed(e); } } }
private void invokeTextAction(JTextComponent text, String actionName) { ActionMap actionMap = text.getActionMap().getParent(); long eventTime = EventQueue.getMostRecentEventTime(); int eventMods = getCurrentEventModifiers(); ActionEvent actionEvent = new ActionEvent(text, ActionEvent.ACTION_PERFORMED, actionName, eventTime, eventMods); actionMap.get(actionName).actionPerformed(actionEvent); }
private void invokeTextAction(JTextComponent text, String actionName) { ActionMap actionMap = text.getActionMap().getParent(); long eventTime = EventQueue.getMostRecentEventTime(); int eventMods = getCurrentEventModifiers(); ActionEvent actionEvent = new ActionEvent(text, ActionEvent.ACTION_PERFORMED, actionName, eventTime, eventMods); actionMap.get(actionName).actionPerformed(actionEvent); }
/** * Notifies all listeners that have registered interest for notification on * this event type. The event instance is lazily created. The listener list * is processed in last to first order. * * @see EventListenerList */ protected void fireActionPerformed() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); int modifiers = 0; AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof InputEvent) { modifiers = ((InputEvent) currentEvent).getModifiers(); } else if (currentEvent instanceof ActionEvent) { modifiers = ((ActionEvent) currentEvent).getModifiers(); } ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, (command != null) ? command : searchField.getText(), EventQueue.getMostRecentEventTime(), modifiers); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ActionListener.class) { ((ActionListener) listeners[i + 1]).actionPerformed(e); } } }
@Override public void actionPerformed(ActionEvent e) { if (!isEnabled() || !commandButton.isVisible() || !commandButton.isDisplayable()) { // stop the timer when the button becomes // disabled, invisible or undisplayable autoRepeatTimer.stop(); return; } fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, getActionCommand(), EventQueue.getMostRecentEventTime(), modifiers)); } });
protected void fireActionPerformed(String command) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); long mostRecentEventTime = EventQueue.getMostRecentEventTime(); int modifiers = 0; AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof InputEvent) { modifiers = ((InputEvent)currentEvent).getModifiers(); } else if (currentEvent instanceof ActionEvent) { modifiers = ((ActionEvent)currentEvent).getModifiers(); } ActionEvent e = null; // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==ActionListener.class) { // Lazily create the event: if (e == null) { e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, command, mostRecentEventTime, modifiers); } ((ActionListener)listeners[i+1]).actionPerformed(e); } } }
/** * This will make the comboBox fire an ActionEvent if the editor * value is different from the selected item in the model. * This allows for the entering of data in the combo box editor and * sends notification when tabbing or clicking out of focus. */ public void focusLost(FocusEvent e) { ComboBoxEditor editor= comboBox.getEditor(); Object item= editor.getItem(); if (!e.isTemporary() && item != null && !item.equals(comboBox.getSelectedItem())) { comboBox.actionPerformed( new ActionEvent( editor, 0, "", EventQueue.getMostRecentEventTime(), 0)); } } }
/** * DOCUMENT ME! * * @param action DOCUMENT ME! */ protected void fireAction(ActionListener action) { int modifiers = 0; AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof InputEvent) { modifiers = ((InputEvent) currentEvent).getModifiers(); } else if (currentEvent instanceof ActionEvent) { modifiers = ((ActionEvent) currentEvent).getModifiers(); } ActionEvent e = new ActionEvent(getComponent(), ActionEvent.ACTION_PERFORMED, getComponent().getText(), EventQueue.getMostRecentEventTime(), modifiers); action.actionPerformed(e); }
/** * This Functions fires a F11 Command to the Canvas. */ public void fireFullscreen() { JmeCanvasContext context = (JmeCanvasContext)getContext(); KeyEvent event = new KeyEvent(context.getCanvas(), KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_F11, KeyEvent.CHAR_UNDEFINED); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); cleanupPostFilter = true; }
protected void paintWheel(Graphics2D g) { int w = getWidth() - wheelInsets.left - wheelInsets.right; int h = getHeight() - wheelInsets.top - wheelInsets.bottom; if (colorWheelImage == null || colorWheelImage.getWidth(this) != w || colorWheelImage.getHeight(this) != h) { if (colorWheelImage != null) { colorWheelImage.flush(); } colorWheelProducer = createWheelProducer(w, h); colorWheelImage = createImage(colorWheelProducer); } colorWheelProducer.setVerticalValue(model.getComponent(verticalIndex)); if (colorWheelProducer.needsGeneration()) { // To keep the UI responsive, we only perform the time consuming // regeneration of the color track if we don't already have // a latency of more than a 10th of a second on the most recent event. long latency = System.currentTimeMillis() - EventQueue.getMostRecentEventTime(); if (latency > 100) { repaint(); } else { colorWheelProducer.regenerateColorWheel(); } } g.drawImage(colorWheelImage, wheelInsets.left, wheelInsets.top, this); }
/** * Implementation copied from BasicComboBoxUI.Handler.focusLost and * changed slightly as seen in the comments below. */ public void focusLost(FocusEvent e) { if (e.getSource() == getEditor().getEditorComponent()) { final ComboBoxEditor editor = getEditor(); final Object item = editor.getItem(); if (!e.isTemporary() && item != null && !item.equals(getSelectedItem())) actionPerformed(new ActionEvent(editor, 0, "", EventQueue.getMostRecentEventTime(), 0)); } // the 2 lines of code below are copied from BasicComboBoxUI.Handler.focusLost // and represent the reason why we must tear out the FocusListener and replace // it with one of our own - it screws up the installation of this JComboBox as // a TableCellEditor by hiding the ComboBoxPopup on the first keystroke. // // if (!e.isTemporary()) // setPopupVisible(false); repaint(); }
@Override public void mouseEntered(MouseEvent e) { if (commandButton.isEnabled()) { int modifiers = 0; AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof InputEvent) { modifiers = ((InputEvent) currentEvent).getModifiers(); } else if (currentEvent instanceof ActionEvent) { modifiers = ((ActionEvent) currentEvent).getModifiers(); } fireRolloverActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, commandButton .getActionModel().getActionCommand(), EventQueue.getMostRecentEventTime(), modifiers)); processPopupAction(); } } };
@Override public void setPressed(boolean b) { if ((isPressed() == b) || !isEnabled()) { return; } if (b) { stateMask |= PRESSED; } else { stateMask &= ~PRESSED; } if (isPressed() && isArmed()) { // fire the popup action on button press and not on button // release - like the comboboxes int modifiers = 0; AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof InputEvent) { modifiers = ((InputEvent) currentEvent).getModifiers(); } else if (currentEvent instanceof ActionEvent) { modifiers = ((ActionEvent) currentEvent).getModifiers(); } firePopupActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, getActionCommand(), EventQueue.getMostRecentEventTime(), modifiers)); } fireStateChanged(); }
long latency = System.currentTimeMillis() - EventQueue.getMostRecentEventTime(); if (latency > 100) { slider.repaint();
new ActionEvent(this, ActionEvent.ACTION_PERFORMED, getActionCommand(), EventQueue.getMostRecentEventTime(), modifiers));
EventQueue.getMostRecentEventTime(), modifiers));