Example usage for javafx.scene.shape Arc addEventHandler

List of usage examples for javafx.scene.shape Arc addEventHandler

Introduction

In this page you can find the example usage for javafx.scene.shape Arc addEventHandler.

Prototype

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

Source Link

Document

Registers an event handler to this node.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");

    Group g = new Group();
    Scene scene = new Scene(g, 550, 250);

    Arc arc = new Arc();
    arc.setCenterX(50.0f);//from   ww w. j  a v a  2 s. co  m
    arc.setCenterY(50.0f);
    arc.setRadiusX(25.0f);
    arc.setRadiusY(25.0f);
    arc.setStartAngle(45.0f);
    arc.setLength(270.0f);
    arc.setType(ArcType.ROUND);

    arc.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            System.out.println("left");
        }
    });
    g.getChildren().add(arc);

    primaryStage.setScene(scene);
    primaryStage.show();
}