/** The method takes parameters and returns, square shape figure */
 private GRect rectangle(int x, int y, int width, int height, Color colorSetFill, Color colorSet) {
   GRect rectangle = new GRect(x, y, width, height);
   rectangle.setFilled(true);
   rectangle.setFillColor(colorSetFill);
   rectangle.setColor(colorSet);
   add(rectangle);
   return rectangle;
 }
示例#2
0
 private void buildHead() {
   double startingWidth = ((getWidth() / 2) - (head_width / 2));
   double startingHeight = ((getHeight() / 2) - (head_height / 2));
   GRect face = new GRect(startingWidth, startingHeight, head_width, head_height);
   add(face);
   face.setFilled(true);
   face.setFillColor(Color.GRAY);
 }
示例#3
0
 private void buildMouth() {
   double startingWidth = getWidth() / 2 - mouth_width / 2;
   double startingHeight = getHeight() / 2 + head_height / 4 - mouth_height / 2;
   GRect mouth = new GRect(startingWidth, startingHeight, mouth_width, mouth_height);
   add(mouth);
   mouth.setColor(Color.WHITE);
   mouth.setFilled(true);
   mouth.setFillColor(Color.WHITE);
 }