Example usage for javafx.event Event fireEvent

List of usage examples for javafx.event Event fireEvent

Introduction

In this page you can find the example usage for javafx.event Event fireEvent.

Prototype

public static void fireEvent(EventTarget eventTarget, Event event) 

Source Link

Document

Fires the specified event.

Usage

From source file:edu.mit.lib.handbag.Controller.java

public void setAgent(String agent) {
    this.agent = agent;
    Event.fireEvent(workflowChoiceBox, new ActionEvent("agent", null));
}

From source file:org.eclipse.jubula.rc.javafx.driver.RobotJavaFXImpl.java

/**
 * {@inheritDoc} <br>//from   w w w.j  a  v a  2 s .c o  m
 * <b>* Currently delegates the key type to the Robot </b>
 */
public void type(final Object graphicsComponent, char c) throws RobotException {

    Validate.notNull(graphicsComponent, "The graphic component must not be null"); //$NON-NLS-1$

    final KeyEvent event = new KeyEvent(KeyEvent.KEY_TYPED, String.valueOf(c), StringUtils.EMPTY, null, false,
            false, false, false);

    InterceptorOptions options = new InterceptorOptions(new long[] { AWTEvent.KEY_EVENT_MASK });
    IRobotEventConfirmer confirmer = m_interceptor.intercept(options);

    m_queuer.invokeLater("Type character", new Runnable() { //$NON-NLS-1$
        @Override
        public void run() {
            final Scene scene;
            if (graphicsComponent instanceof Stage) {
                scene = ((Stage) graphicsComponent).getScene();
            } else {
                scene = ((Node) graphicsComponent).getScene();
            }

            Node focusOwner = scene.getFocusOwner();
            EventTarget eventTarget = focusOwner != null ? focusOwner : scene;

            Event.fireEvent(eventTarget, event);
        }
    });

    confirmer.waitToConfirm(graphicsComponent, new KeyJavaFXEventMatcher(KeyEvent.KEY_TYPED));

}