1

を作成しGridPaneて呼び出した後Snapshot()、取得した画像には、色と幅が異なるように見えるグリッド線があります。薄いものは明るく、厚いものは暗い。何かご意見は?

     //Create the gridpane
     GridPane gPane = new GridPane();
     gPane.setSnapToPixel(true);

     //Set background, padding, and hgap and vgap to create the "border"
     gPane.setStyle("-fx-background-color: DARKGREY; -fx-padding: 1;"
                    +"-fx-hgap: 1; -fx-vgap: 1;");

     //Populate the gridpane with colored rectangles
     for(int i=0; i<mainApp.getItemList().size(); i++){ // rows
         for(int j=0; j<mainApp.getItemList().get(0).size(); j++){ //columns


             Color color = mainApp.getItemList().get(i).get(j).getValue().getDisplayColor();
                int r = (int) (color.getRed() * 255);
                int g = (int) (color.getGreen() * 255);
                int b = (int) (color.getBlue() * 255);

             Rectangle rect = new Rectangle(5,5);

             rect.setStyle("-fx-fill: rgb(" + r + "," + g + "," + b + ");");
             gPane.add(rect, j, i);
         }
     }
4

0 に答える 0