import
javafx.application.Application;
import
javafx.scene.Scene;
import
javafx.scene.control.Button;
import
javafx.scene.layout.*;
import
javafx.event.ActionEvent;
import
javafx.event.EventHandler;
import
javafx.scene.control.Label;
import
javafx.stage.Stage;
import
javafx.scene.Cursor;
public
class
cursor_1
extends
Application {
int
i =
0
;
public
void
start(Stage stage)
{
stage.setTitle(
"Creating Cursor"
);
Button button =
new
Button(
"cursor"
);
TilePane tilepane =
new
TilePane();
Label label =
new
Label(
"Cursor Example"
);
Cursor cursor_[] = {Cursor.CLOSED_HAND, Cursor.CROSSHAIR,
Cursor.DEFAULT, Cursor.DISAPPEAR,
Cursor.E_RESIZE, Cursor.H_RESIZE,
Cursor.HAND, Cursor.MOVE,
Cursor.N_RESIZE, Cursor.NE_RESIZE,
Cursor.NONE, Cursor.NW_RESIZE,
Cursor.OPEN_HAND, Cursor.SE_RESIZE,
Cursor.SW_RESIZE, Cursor.TEXT,
Cursor.V_RESIZE, Cursor.W_RESIZE,
Cursor.WAIT};
tilepane.getChildren().add(button);
tilepane.getChildren().add(label);
Scene scene =
new
Scene(tilepane,
200
,
200
);
scene.setCursor(cursor_[
0
]);
EventHandler<ActionEvent> event =
new
EventHandler<ActionEvent>()
{
public
void
handle(ActionEvent e)
{
if
(i == cursor_.length -
1
)
i = -
1
;
scene.setCursor(cursor_[++i]);
}
};
button.setOnAction(event);
stage.setScene(scene);
stage.show();
}
public
static
void
main(String args[])
{
launch(args);
}
}