package javafxtemplate1; // //textProperty().addListener Listview Label import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.stage.Stage; //import javafx.scene.layout.Group; /** * * @author Manas9 */ public class JavaFXTemplate1 extends Application { Group group1,group2;// = new Group(); //Group groot1, groot2; Button btn1, btn2; Stage thisstage; @Override public void start(Stage primaryStage) throws Exception { // thisstage= primaryStage; group1 = new Group();group2 = new Group(); btn1 = new Button("Group1"); btn2= new Button("Group2"); btn1.setLayoutX(10); btn1.setLayoutY(10); btn2.setLayoutX(100); btn2.setLayoutY(10); // btn1.setOnAction(e->ctrlbutton1_click()); btn2.setOnAction(e->ctrlbutton2_click()); // group1.getChildren().addAll(btn1,btn2); //canvas2.getChildren().addAll(btn1,btn2); Scene scene = new Scene(group1, 300, 150); primaryStage.setScene(scene); primaryStage.setTitle("Manage Style:: Group"); primaryStage.show(); } public static void main(String[] args) { launch(args); } public void ctrlbutton1_click() { //System.out.println("setOnAction event :: button Clicked"); //caption.setText("Button Clicked"); group1.setStyle("-fx-background-color: green;"); } public void ctrlbutton2_click() { //System.out.println("setOnAction event :: button Clicked"); //caption.setText("Button Clicked"); group1.setStyle("-fx-background-color: red;"); } } /* Convert using Integer.toString(int) Convert using String.valueOf(int) Convert using new Integer(int).toString() Convert using String.format() canvas.setStyle("-fx-background-color: black;"); */