Package javafx.event

Examples of javafx.event.EventDispatcher


     * button click, preventing the default menu from appearing. It propagates the mouse
     * click further so other elements will respond appropriately.
     *
     * TODO this should be refactored once the API is updated.
     */
    final EventDispatcher initial = textArea.getEventDispatcher();
    textArea.setEventDispatcher(new EventDispatcher() {
      @Override
      public Event dispatchEvent(Event event, EventDispatchChain tail) {
        if (event instanceof MouseEvent) {
          MouseEvent mouseEvent = (MouseEvent)event;
          if (mouseEvent.getButton() == MouseButton.SECONDARY ||
              (mouseEvent.getButton() == MouseButton.PRIMARY && mouseEvent.isControlDown())) {
            event.consume();
          }
        }
        return initial.dispatchEvent(event, tail);
      }
    });
   
    // make the new context menu including the clear option   
    MenuItem copySelected = new MenuItem("Copy");
View Full Code Here

TOP

Related Classes of javafx.event.EventDispatcher

Copyright © 2018 www.massapicom. 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.