Java:制作棋盘(8x8)

时间:2017-07-14 02:07:10

标签: java

我在第一栏中获得了棋盘图案;但是,我不能让它继续通过整个董事会。这只是为了提升我作为程序员的技能。让我知道我可以改进的地方! (有问题的代码)

@Override
public void start(Stage primaryStage){
    //Creates pane
    AnchorPane pane = new AnchorPane();
    Scene scene = new Scene(pane);
    primaryStage.setScene(scene);

    int columns = 8, row = 8, horizontal = 125, vertical = 125;
    Rectangle rectangle = null;
    for(int i = 0; i < columns; i++){
        for(int j = 0; j < row; j++){
            //creates the rectangles, and outlines them
            rectangle = new Rectangle(horizontal*j, vertical*i, horizontal, vertical);
            rectangle.setStroke(Color.WHITE);

                    if ( j+i % 2 == 0 ) {
                        rectangle.setFill(Color.WHITE);
                    } else {
                        rectangle.setFill(Color.BLACK);
                    }//end else

            //put rectangles into the pane
            pane.getChildren().add(rectangle);
        }//end for-loop j
    }//end for-loop i

    //create a scene and place it in the stage
    scene.setRoot(pane);
    primaryStage.setTitle("Checkerboard");
    primaryStage.show();
}//end primaryStage

1 个答案:

答案 0 :(得分:4)

$file_local = Storage::disk('local')->get('public/uploads/ftp/file.pdf'); $file_ftp = Storage::disk('ftp')->put('/file.pdf', $file_local'); 的优先级高于%,并首先进行评估。使用括号来获得正确的计算。

+