JavaFX 麻将布局 BorderPane

package fx.com;

import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

import java.net.URL;

public class Main extends Application {
    public static void main(String[] args) {
        Application.launch(Main.class,args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        String _EE6AA7 ="-fx-background-color: #EE6AA7;" +
                "-fx-pref-width: 100;" +
                "-fx-pref-height: 100";
        AnchorPane a1 = new AnchorPane();
        a1.setStyle(_EE6AA7);

        String _98FB98 ="-fx-background-color: #98FB98;" +
                "-fx-pref-width: 100;" +
                "-fx-pref-height: 100";
        AnchorPane a2 = new AnchorPane();
        a2.setStyle(_98FB98);

        String A0522D ="-fx-background-color: #A0522D;" +
                "-fx-pref-width: 100;" +
                "-fx-pref-height: 100";
        AnchorPane a3 = new AnchorPane();
        a3.setStyle(A0522D);

        String _1E90FF ="-fx-background-color: #1E90FF;" +
                "-fx-pref-width: 100;" +
                "-fx-pref-height: 100";
        AnchorPane a4 = new AnchorPane();
        a4.setStyle(_1E90FF);

        String EEEE00 ="-fx-background-color: #EEEE00;" +
                "-fx-pref-width: 100;" +
                "-fx-pref-height: 100";
        AnchorPane a5 = new AnchorPane();
        a5.setStyle(EEEE00);
        Parent bor = new BorderPane();
        ((BorderPane) bor).setTop(a1);
        ((BorderPane) bor).setBottom(a2);
        ((BorderPane) bor).setLeft(a3);
        ((BorderPane) bor).setRight(a4);
        ((BorderPane) bor).setCenter(a5);
        bor.setStyle("-fx-background-color: #B23AEE");
        Scene scene = new Scene(bor);
        primaryStage.setScene(scene);
        primaryStage.setWidth(800);
        primaryStage.setHeight(800);
        primaryStage.setTitle("麻将布局");
        primaryStage.getIcons().add(new Image("http://www.haotuo.net.cn/Resources/cq/qunlogo.png"));
        primaryStage.show();

    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值