/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package colorcube; import javafx.application.Application; import javafx.application.ConditionalFeature; import javafx.application.Platform; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.input.MouseEvent; import javafx.scene.paint.Color; import javafx.scene.paint.CycleMethod; import javafx.scene.paint.LinearGradient; import javafx.scene.paint.Stop; import javafx.stage.Stage; /** * * @author Kirill */ public class ButtonTest extends Application { @Override public void start(Stage stage) { Group g = new Group(); Button b1 = new Button("Button1"); Button b2 = new Button("Button2"); b2.setTranslateX(20); b2.setTranslateY(10); b1.setTranslateZ(10); b1.setOnMouseClicked(new EventHandler() { public void handle(MouseEvent t) { System.out.println("Button1"); } }); b2.setOnMouseClicked(new EventHandler() { public void handle(MouseEvent t) { System.out.println("Button2"); } }); g.getChildren().addAll(b2, b1); Scene scene = new Scene(g, 1024, 600, true); stage.setScene(scene); stage.sizeToScene(); stage.show(); } public static void main(String[] args) { Application.launch(args); } }