标签:
public class EffectTest extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Button Sample"); stage.setWidth(300); stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); Image image = new Image(getClass().getResourceAsStream("/effecttest/img/1156909.png")); Button button1 = new Button("Accept"); button1.setGraphic(new ImageView(image)); button1.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Accepted"); } }); vbox.getChildren().add(button1); vbox.setSpacing(10); ((Group)scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); } }
标签:
原文地址:http://www.cnblogs.com/rojas/p/4720423.html