Java Code Examples for javafx.scene.control.Button.setCursor()

The following are Jave code examples for showing how to use setCursor() of the javafx.scene.control.Button class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: domino-todolist   File: DesktopLayoutView.java   Source Code and License Vote up 9 votes
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setOnShowing(event -> uiHandlers.onShow());
    BorderPane border = new BorderPane();
    hbox = new HBox();
    border.setTop(hbox);
    hbox.setMinHeight(60);
    hbox.setAlignment(Pos.CENTER_LEFT);
    hbox.setBackground(new Background(new BackgroundFill(Color.web("#2196f3"), CornerRadii.EMPTY, Insets.EMPTY)));
    hbox.setPadding(new Insets(10));

    menu = new VBox();
    menu.setPadding(new Insets(20, 0, 0, 0));
    BorderStroke borderStroke = new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(0,1,0,0));

    menu.setBorder(new Border(borderStroke));
    menu.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    menu.setMinWidth(50);
    menu.setSpacing(20);
    border.setLeft(menu);


    primaryStage.setTitle("Todo list");

    Text text = new Text("Todo List");
    text.setFill(Color.WHITE);
    text.setFont(Font.font("Verdana", FontWeight.BOLD, 25));

    center = new VBox();
    center.setPadding(new Insets(20));
    center.setSpacing(10);
    Image image = new Image(getClass().getResourceAsStream("/add.png"));
    Button add = new Button("", new ImageView(image));
    add.setCursor(Cursor.HAND);
    add.setBackground(Background.EMPTY);
    add.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
    add.setOnAction(event -> uiHandlers.onCreate());

    border.setCenter(center);

    hbox.setPadding(new Insets(10, 10, 10, 10));

    final Pane spacer = new Pane();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    spacer.setMinSize(10, 1);
    hbox.getChildren().addAll(text, spacer, add);

    primaryStage.setScene(new Scene(border, 500, 500));
    primaryStage.show();
}
 
Example 2
Project: domino-todolist   File: DesktopLayoutView.java   Source Code and License Vote up 7 votes
@Override
public void addMenuItem(LayoutContext.LayoutMenuItem layoutMenuItem) {
    Image image = new Image(getClass().getResourceAsStream("/" + layoutMenuItem.icon() + ".png"));
    Button item = new Button("", new ImageView(image));
    item.setTooltip(new Tooltip(layoutMenuItem.text()));
    item.setCursor(Cursor.HAND);
    item.setBackground(Background.EMPTY);
    item.setMinWidth(menu.getMinWidth());
    item.setOnAction(event -> layoutMenuItem.selectHandler().onSelect());
    menu.getChildren().add(item);
}