import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class ABC extends Application {
private VBox root;
private VBox updown;
private StackPane upAB;
private StackPane downA;
private StackPane upC;
private StackPane downC;
private StackPane downB;
public static void main(String[] args) {
launch(args);
}
@
Override public void start(Stage stage) {
HBox headBtns = new HBox();
Button btnA = new Button("A");
btnA.setOnAction(e -> updown.getChildren().setAll(upAB, downA));
Button btnB = new Button("B");
btnB.setOnAction(e -> updown.getChildren().setAll(upAB, downB));
Button btnC = new Button("C");
btnC.setOnAction(e -> updown.getChildren().setAll(upC, downC));
headBtns.getChildren().addAll(btnA, btnB, btnC);
updown = new VBox();
upAB = new StackPane();
upAB.setStyle("-fx-background-color: #FF0000");
upAB.getChildren().add(new Text("A&B"));
downA = new StackPane();
downA.setStyle("-fx-background-color: #007FFF");
downA.getChildren().add(new Text("A&B: A"));
downB = new StackPane();
downB.setStyle("-fx-background-color: #00FF7F");
downB.getChildren().add(new Text("A&B: B"));
upC = new StackPane();
upC.setStyle("-fx-background-color: #D9D919");
upC.getChildren().add(new Text("C"));
downC = new StackPane();
downC.setStyle("-fx-background-color: #CD7F32");
downC.getChildren().add(new Text("C"));
updown.getChildren().addAll(upAB, downA);
root = new VBox();
root.getChildren().addAll(headBtns, updown);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
}