Example usage for javafx.scene Node addEventFilter

List of usage examples for javafx.scene Node addEventFilter

Introduction

In this page you can find the example usage for javafx.scene Node addEventFilter.

Prototype

public final <T extends Event> void addEventFilter(final EventType<T> eventType,
        final EventHandler<? super T> eventFilter) 

Source Link

Document

Registers an event filter to this node.

Usage

From source file:org.noroomattheinn.visibletesla.App.java

/**
 * Begin watching for user inactivity (keyboard input, mouse movements, etc.)
 * on any of the specified Tabs.//from w  w w.java2s.  c o  m
 * @param tabs  Watch for user activity targeted to any of these tabs.
 */
void watchForUserActivity(List<Tab> tabs) {
    for (Tab t : tabs) {
        Node n = t.getContent();
        n.addEventFilter(KeyEvent.ANY, new EventPassThrough());
        n.addEventFilter(MouseEvent.MOUSE_PRESSED, new EventPassThrough());
        n.addEventFilter(MouseEvent.MOUSE_RELEASED, new EventPassThrough());
    }
    ThreadManager.get().launch(new InactivityThread(60L * 1000L * prefs.idleThresholdInMinutes.get()),
            "Inactivity");
}