private void handleEvent(AWTEvent event) { MagePane frame = activeFrame; // support multiple mage panes Object source = event.getSource(); if (source instanceof Component) { Component component = (Component) source; while (component != null) { if (component instanceof MagePane) { frame = (MagePane) component; break; } component = component.getParent(); } } if (frame != null) { frame.handleEvent(event); } }
while (isVisible()) { AWTEvent event = theQueue.getNextEvent(); Object source = event.getSource(); boolean dispatch = true; if (event.getSource() != null && event.getSource() instanceof TrayIcon && !(event instanceof InvocationEvent)) { dispatch = false; if (event instanceof MouseEvent && event.getSource() instanceof Component) { MouseEvent e = (MouseEvent) event; MouseEvent m = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, this);
while (!selected) { AWTEvent event = theQueue.getNextEvent(); Object source = event.getSource(); boolean dispatch = true;
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { Object source = event.getSource(); if (source instanceof JComponent) { JComponent comp = (JComponent) source; if (SwingUtilities.isDescendingFrom(parent, comp)) { // The mouse is in the house... } } } }, MouseEvent.MOUSE_MOVED);
public void eventDispatched(AWTEvent e) { if (e instanceof MouseEvent) { Component c = (Component)e.getSource(); Window w = c instanceof Window ? (Window)c : SwingUtilities.getWindowAncestor(c); markWindowReady(w); } } }
@Override public void eventDispatched(AWTEvent event) { if (event instanceof KeyEvent && ((KeyEvent)event).getKeyCode() == KeyEvent.VK_TAB && (!(event.getSource() instanceof JTextComponent)) && (!(event.getSource() instanceof JList)) && !isFullKeyboardAccessEnabled()) ((KeyEvent)event).consume(); } };
/** * Indicates whether the id of the given event is equal to {@code WindowEvent.COMPONENT_SHOWN} and the source of the * event is a {@code Window}. * * @param e the given event. * @return {@code true} if the id of the given event is equal to {@code COMPONENT_SHOWN} and the source of the event * is a {@code Window}; {@code false} otherwise. */ public static boolean wasWindowShown(@Nonnull AWTEvent e) { return e.getID() == COMPONENT_SHOWN && e.getSource() instanceof Window; }
@Override public void eventDispatched(AWTEvent arg0) { if (arg0 instanceof MouseEvent && MouseEvent.MOUSE_RELEASED == arg0.getID() && arg0.getSource() instanceof JTextComponent) { MouseEvent me = (MouseEvent) arg0; JTextComponent tc = (JTextComponent) arg0.getSource(); if (me.isPopupTrigger() && tc.getComponentPopupMenu() == null) { TextFieldPopupMenu.buildCutCopyPaste().show(tc, me.getX(), me.getY()); } } } }, AWTEvent.MOUSE_EVENT_MASK);
return; if (event.getSource() == popup) { if (popup.isShowing() && e.getID() == MouseEvent.MOUSE_EXITED) { int minX = popup.getLocationOnScreen().x;
private void onClick(AWTEvent event) { Component component = (Component) event.getSource(); if (outsideOfTooltipWindow(component)) { // hide the tooltip if event occurs outside of the tooltip shutdown(); } }
public void eventDispatched( AWTEvent event ) { // There are unintuitive interactions with the automatic closing of the frame // and the component which is clicked to show the frame. The easiest solution // (although probably not the best/cleanest) is to simply ignore events from // those control components. if ( !ignore.contains( event.getSource( ) ) && ( event.getID( ) == MouseEvent.MOUSE_PRESSED || event.getID( ) == FocusEvent.FOCUS_LOST ) ) { ErrorPopupPanel.this.hideErrorPopup( ); } } };
@Override public void menuSelectionChanged(boolean isIncluded) { if (!isIncluded) { final Object source = EventQueue.getCurrentEvent().getSource(); if (source instanceof Component) { final Component c = (Component) source; isIncluded = SwingUtilities.isDescendingFrom(c, this); } } super.menuSelectionChanged(isIncluded); } }
/** * Transfers the event to {@link KeyPromoterAction} and inspects the results. Then, depending on the result and the * Key Promoter X settings, a balloon is shown with the shortcut tip and the statistic is updated. * * @param e event that is handled */ private void handleMouseEvent(AWTEvent e) { wasMouseClick = true; if (e.getSource() instanceof StripeButton && keyPromoterSettings.isToolWindowButtonsEnabled()) { KeyPromoterAction action = new KeyPromoterAction(e); showTip(action); } }
@Override public void eventDispatched(AWTEvent event) { if (event != null && MouseEvent.MOUSE_MOVED == event.getID()) { Object source = event.getSource(); if (source instanceof Component) { JScrollPane pane = UIUtil.getParentOfType(JScrollPane.class, (Component)source); if (pane != null) { pauseThumbAnimation(pane.getHorizontalScrollBar()); pauseThumbAnimation(pane.getVerticalScrollBar()); } } } }
@Override public boolean dialogItemChanged( final GenericDialog dialog, final AWTEvent e ) { if ( e instanceof ItemEvent && e.getID() == ItemEvent.ITEM_STATE_CHANGED && e.getSource() == choice ) { label.setText( formatEntry( datasetDefinitions.get( choice.getSelectedIndex() ).getExtendedDescription(), numCharacters, numLinesDocumentation ) ); } return true; } } );