Java 8 EventObject - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 EventObject class.

This code example shows how to use the following methods:getNewValue, getOldValue, getPropertyName, getSource
        refreshButton = rb;
    } 
 
    @Override 
    public void propertyChange(PropertyChangeEvent evt) {
        if (names.contains(evt.getPropertyName())) {
            if(evt.getPropertyName().equals(PROPERTY_NAME_USE_ROI_MASK) && evt.getNewValue().equals(true) &&
                ((PropertyContainer)evt.getSource()).getProperty(PROPERTY_NAME_ROI_MASK).getValue()==null){
                return; 
            } 
            else if(evt.getPropertyName().equals(PROPERTY_NAME_NUM_BINS) && evt.getOldValue().equals(evt.getNewValue())){
                return; 
            } 
            else if(evt.getPropertyName().equals(PROPERTY_NAME_AUTO_MIN_MAX) && evt.getNewValue().equals(false)){
                return; 
            } 
            else if(evt.getPropertyName().equals(PROPERTY_NAME_MIN) && (evt.getOldValue().equals(evt.getNewValue()) ||
                ((PropertyContainer)evt.getSource()).getProperty(PROPERTY_NAME_AUTO_MIN_MAX).getValue().equals(true))){
                return; 
            } 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getNewValue, getOldValue, getPropagationId, getPropertyName, getSource
		super(source, propertyName, oldValue, newValue);
	} 
 
	@SuppressWarnings("unchecked") 
	public GenericPropertyChangeEvent(final PropertyChangeEvent propertyChangeEvent) {
		this(propertyChangeEvent.getSource(),
				propertyChangeEvent.getPropertyName(),
				(V)propertyChangeEvent.getOldValue(),
				(V)propertyChangeEvent.getNewValue());
		setPropagationId(propertyChangeEvent.getPropagationId());
	} 
 
	@SuppressWarnings("unchecked") 
	public V getOldValue() { 
		return (V)super.getOldValue(); 
	} 
 
	@SuppressWarnings("unchecked") 
	public V getNewValue() { 
		return (V)super.getNewValue(); 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSource, setSource
	 * @throws IllegalArgumentException if the supplied {@code notification} is {@code null} 
	 * @throws UnableToSendNotificationException if the supplied {@code notification} could not be sent 
	 */ 
	@Override 
	public void sendNotification(Notification notification) {
		Assert.notNull(notification, "Notification must not be null");
		replaceNotificationSourceIfNecessary(notification);
		try { 
			if (notification instanceof AttributeChangeNotification) {
				this.modelMBean.sendAttributeChangeNotification((AttributeChangeNotification) notification);
			} 
			else { 
				this.modelMBean.sendNotification(notification);
			} 
		} 
		catch (MBeanException ex) {
			throw new UnableToSendNotificationException("Unable to send notification [" + notification + "]", ex);
		} 
	} 
 

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getID, getComponent, getX, getY, getSource
  protected void dispatchEvent(AWTEvent e) {
    // TODO: implement enter/exit events 
    // TODO: change source to drag source, not mouse under 
    if (nativeDnd.isNativeDragAndDrop(e)) {
      MouseEvent mouseEvent = (MouseEvent) e;
      Component target = getDeepestComponentAt(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
      if (target != mouseEvent.getSource()) {
        mouseEvent = convertMouseEvent(mouseEvent.getComponent(), mouseEvent, target);
      } 
      relayDndEvent(mouseEvent);
    } 
    super.dispatchEvent(e);
  } 
 
  private void relayDndEvent(@Nonnull MouseEvent event) {
    int eventId = event.getID();
    if (eventId == MOUSE_MOVED || eventId == MOUSE_DRAGGED) {
      if ((mask & MOUSE_MOTION_EVENT_MASK) != 0) {
        eventListener.eventDispatched(event);
      } 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getNewValue, getOldValue, getPropagationId, getPropertyName, setPropagationId
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getNewValue, getOldValue, getPropertyName, getSource
    /** 
     * Invoked when a property changes. We are only interested in when the 
     * Document changes to reset the DocumentListener. 
     */ 
    public void propertyChange(PropertyChangeEvent e) {
        if (e.getSource() == getEditor() && e.getPropertyName().equals(
                "document")) { 
            Document oldDoc = (Document) e.getOldValue();
            Document newDoc = (Document) e.getNewValue();
 
            // Reset the DocumentListener 
            oldDoc.removeDocumentListener(this);
            newDoc.addDocumentListener(this);
 
            // Recreate the TreeModel. 
            treeModel = new ElementTreeModel(newDoc);
            tree.setModel(treeModel);
        } 
    } 
 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getNewValue, getOldValue, getPropertyName, getSource
     * 
     * @param evt The <code>PropertyChangeEvent</code> object. 
     */ 
    public void firePropertyChange(PropertyChangeEvent evt) {
        if(!(evt instanceof PropertyChangeEventJAI)) {
            evt = new PropertyChangeEventJAI(evt.getSource(),
                                             evt.getPropertyName(),
                                             evt.getOldValue(),
                                             evt.getNewValue());
        } 
        super.firePropertyChange(evt);
    } 
 
    /** 
     * Report a bound property update to any registered listeners. 
     * A <code>PropertyChangeEventJAI</code> is created from the cached 
     * property event source and the supplied parameters and fired using 
     * the superclass <code>firePropertyChange(PropertyChangeEvent)</code> 
     * method. 
     * 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getNewValue, getOldValue, getPropagationId, getPropertyName, setPropagationId
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSource, getDescription, getEventType, getURL
     
    public class LinkToolTipListener implements HyperlinkListener {
        public LinkToolTipListener() { 
        } 
        public void hyperlinkUpdate(HyperlinkEvent he) {
            EventType type = he.getEventType();
            if (type == EventType.ENTERED) {
                JEditorPane jep = (JEditorPane) he.getSource();
                URL url = he.getURL();
                if (url != null) {
                    jep.setToolTipText(url.toString());
                } else { 
                    jep.setToolTipText(he.getDescription());
                } 
            } else if (type == EventType.EXITED) {
                JEditorPane jep = (JEditorPane) he.getSource();
                jep.setToolTipText("");
            } 
        } 
    } 
     
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSource, getSequenceNumber, getTimeStamp, getType, getUserData
        } 
    } 
 
    private static Map buildOperationNotificationPacket(Notification note) {
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("event", note.getType());
        result.put("source", note.getSource());
        result.put("sequenceNumber", note.getSequenceNumber());
        result.put("timeStamp", note.getTimeStamp());
        result.put("data", note.getUserData());
        return result; 
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 EventObject Methods: