@@ -23,7 +23,7 @@ public class GridPanel extends JPanel implements View {
23
23
private int posX = 0 ;
24
24
private int posY = 0 ;
25
25
26
- public GridPanel (final Grid grid ) {
26
+ GridPanel (final Grid grid ) {
27
27
this .grid = grid ;
28
28
this .size = new Dimension (grid .width * BLOCK_SIZE , grid .height * BLOCK_SIZE );
29
29
this .addMouseMotionListener (new MouseMotionAdapter () {
@@ -75,10 +75,9 @@ public void setPiece(Piece piece) {
75
75
}
76
76
77
77
public boolean newGame () {
78
- return JOptionPane .showConfirmDialog (this , "Play again?" ,"Game Over!" ,JOptionPane .YES_NO_OPTION ) == JOptionPane .YES_OPTION ;
78
+ return JOptionPane .showConfirmDialog (this , "Play again?" , "Game Over!" , JOptionPane .YES_NO_OPTION ) == JOptionPane .YES_OPTION ;
79
79
}
80
80
81
- @ Override
82
81
public Grid getGrid () {
83
82
return grid ;
84
83
}
@@ -99,13 +98,13 @@ private void drawBlocks(Graphics2D g2) {
99
98
for (int y = 0 ; y < grid .height ; y ++) {
100
99
double f = (double ) y / grid .height ;
101
100
int green = (int ) (120 + f * (240 - 120 ));
102
- int red = (int ) (120 + (1 - f ) * (240 - 120 ));
101
+ int red = (int ) (120 + (1 - f ) * (240 - 120 ));
103
102
Color blockColor = new Color (red , green , 100 );
104
103
for (int x = 0 ; x < grid .width ; x ++) {
105
104
if (grid .get (x , y )) {
106
105
g2 .setPaint (new GradientPaint (
107
- x * BLOCK_SIZE , y * BLOCK_SIZE , blockColor ,
108
- (x + 1 ) * BLOCK_SIZE , (y + 1 ) * BLOCK_SIZE , blockColor .darker ())
106
+ x * BLOCK_SIZE , y * BLOCK_SIZE , blockColor ,
107
+ (x + 1 ) * BLOCK_SIZE , (y + 1 ) * BLOCK_SIZE , blockColor .darker ())
109
108
);
110
109
g2 .fillRect (x * BLOCK_SIZE , y * BLOCK_SIZE , BLOCK_SIZE , BLOCK_SIZE );
111
110
g2 .setPaint (null );
@@ -142,6 +141,6 @@ private void drawHud(Graphics2D g2) {
142
141
g2 .setRenderingHint (RenderingHints .KEY_TEXT_ANTIALIASING , RenderingHints .VALUE_TEXT_ANTIALIAS_ON );
143
142
g2 .setFont (hudFont );
144
143
g2 .setColor (hudColor );
145
- g2 .drawString (String .format ("%05d pieces, %03d lines" ,grid .getPieceCount (), grid .getLineCount ()), 10 , 20 );
144
+ g2 .drawString (String .format ("%05d pieces, %03d lines" , grid .getPieceCount (), grid .getLineCount ()), 10 , 20 );
146
145
}
147
146
}
0 commit comments