Package java.awt.event

Examples of java.awt.event.ActionListener.actionPerformed()


  @Test
  public void test_weakListener() {
    ActionListener listener = mock(ActionListener.class);
    JButton button = mock(JButton.class);
    ActionListener weakListener = WeakReferences.weakListener(ActionListener.class, listener, button);
    weakListener.actionPerformed(mock(ActionEvent.class));
    verify(listener, times(1)).actionPerformed(any(ActionEvent.class));
    listener = null;
    System.gc();
    weakListener.actionPerformed(mock(ActionEvent.class));
    verify(button, times(1)).removeActionListener(eq(weakListener));
View Full Code Here


    ActionListener weakListener = WeakReferences.weakListener(ActionListener.class, listener, button);
    weakListener.actionPerformed(mock(ActionEvent.class));
    verify(listener, times(1)).actionPerformed(any(ActionEvent.class));
    listener = null;
    System.gc();
    weakListener.actionPerformed(mock(ActionEvent.class));
    verify(button, times(1)).removeActionListener(eq(weakListener));
  }
}
View Full Code Here

    @Override
    public void actionPerformed(final ActionEvent event) {
      ActionListener listener = get(event);
      if (listener != null) {
        listener.actionPerformed(event);
      }
    }
  }
 
  private static class WeakChangeListener extends AbstractWeakListener<ChangeListener, ChangeEvent> implements ChangeListener {
View Full Code Here

    private void notifyListeners(ActionEvent event) {
        if (listeners != null) {
            Iterator<ActionListener> iter = actionListeners.iterator();
            while (iter.hasNext()) {
                ActionListener notifiee = iter.next();
                notifiee.actionPerformed(event);
            }
        }
    }
}
View Full Code Here

            public String doInBackground() {
                if (actionListeners != null) {
                    ListIterator<ActionListener> iter = actionListeners.listIterator();
                    while (iter.hasNext()) {
                        ActionListener listener = iter.next();
                        listener.actionPerformed(e);
                    }
                    iter = null;
                }
                return null;
            }
View Full Code Here

    public void notifyActionListeners(ActionEvent e) {
        if (actionListeners != null) {
            ListIterator<ActionListener> iter = actionListeners.listIterator();
            while (iter.hasNext()) {
                ActionListener listener = iter.next();
                listener.actionPerformed(e);
            }
            iter = null;
        }
    }
View Full Code Here

    public void notifyActionListeners(ActionEvent e) {
        if (actionListeners != null) {
            ListIterator<ActionListener> iter = actionListeners.listIterator();
            while (iter.hasNext()) {
                ActionListener listener = iter.next();
                listener.actionPerformed(e);
            }
            iter = null;
        }
    }
}
View Full Code Here

    public void notifyActionListeners(ActionEvent e) {
        if (actionListeners != null) {
            ListIterator<ActionListener> iter = actionListeners.listIterator();
            while (iter.hasNext()) {
                ActionListener listener = iter.next();
                listener.actionPerformed(e);
            }
            iter = null;
        }
    }
View Full Code Here

                        case UNKNOWN:
                        default:
                            if (c != 0) { // ignore null chars
                                ActionListener action = triggeredActions.get((char) c);
                                if (action != null) {
                                    action.actionPerformed(null);
                                }
                                else {
                                    putChar(c, true);
                                }
                            }
View Full Code Here

                        ActionEvent.ACTION_PERFORMED,
                        actionCommand,
                        event.getWhen(),
                        event.getModifiers());
            }
            listener.actionPerformed(e);
        }
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.