Setup JavaFX Button - Java JavaFX

Java examples for JavaFX:Button

Description

Setup JavaFX Button

Demo Code


//package com.java2s;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

public class Main {
    public static void SetupButton(Button button,
            EventHandler<ActionEvent> event, Image graphic, String css) {
        ImageView imageView = new ImageView(graphic);
        button.setGraphic(imageView);//from  w  ww .j  a v a 2  s.c o  m
        button.setOnAction(event);
        button.getStylesheets().add(css);
    }
}

Related Tutorials