예제 #1
0
 private void colorBrick(int row, GRect brick) {
   if (row < 2) {
     brick.setColor(Color.RED);
   } else if (row < 4) {
     brick.setColor(Color.ORANGE);
   } else if (row < 6) {
     brick.setColor(Color.YELLOW);
   } else if (row < 8) {
     brick.setColor(Color.GREEN);
   } else if (row < 10) {
     brick.setColor(Color.CYAN);
   }
 }
예제 #2
0
 /** Places a rectangle at x,y with width, height and specified color */
 public void place(int x, int y, int width, int height, Color shapeColor) {
   GRect shape = new GRect(x, y, width, height);
   shape.setFilled(true);
   shape.setColor(shapeColor);
   add(shape);
 }