import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class App14_3 extends Application {
Button button1 = new Button("确定");
@Override
public void start(Stage primaryStage) {
// 创建栈面板对象
StackPane stackPane = new StackPane();
// 设置按钮的边框颜色为蓝色
button1.setStyle("-fx-border-color: blue");
Button button2 = new Button("我也是按钮");
// 设置按钮的优先大小,即自定义按钮的大小
button2.setPrefSize(80, 50);
// 将button1按钮的边框颜色设置为绿色
button2.setStyle("-fx-border-color: green");
// 将button1按钮逆时针旋转45°
button2.setRotate(-45);
// 将按钮加入到栈面板中
stackPane.getChildren().addAll(button2, button1);
// 将面板顺时针旋转45°
stackPane.setRotate(45);
stackPane.setStyle("-fx-border-color: red;-fx-background-color: lightgray");
Scene scene = new Scene(stackPane, 180, 100);
primaryStage.setTitle("栈面板");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}