T01Flags P01Rect Introducing Graphics

From Progzoo
Jump to: navigation, search
  • You may want to review: drawing and filling rectangles before tackling these questions.
  • You might want to try coordinates exercises if you are not comfortable with x,y coordinates.


The flag of Libya is a simple green rectangle.

Try the program as it is given, then change it so that the green rectangle is wider. <img src="http://progzoo.net/img/flaglibya.png"/>

[Font] [Default] [Show] [Resize] [History] [Profile]


The flag of France is blue, white and red.

The code given draws only one of the three rectangles required, and it is in the wrong place.
<img src="http://progzoo.net/img/flagfrance.png"/>

[Font] [Default] [Show] [Resize] [History] [Profile]


The flag of Germany is black, red and yellow.

Only one of the three rectangles has been drawn - and that one is in the wrong place. <img src="http://progzoo.net/img/flaggermany.png"/>

[Font] [Default] [Show] [Resize] [History] [Profile]


  • The flag of Palau is a yellow circle on a blue background.
  • The rectangle is 300 by 200.
  • The circle is in position 50,50, width and height are 100,100.
  • The RGB values for the blue: 154,176,217.
  • The dark lines are NOT part of the flag. They are shown as guides only.

<img src="http://progzoo.net/img/flagpalau.png"/>

In order to draw a circle we need to track down a method of Graphics or Graphics2D. There is no fillCircle method - but you should find something else that will do the job.

[Font] [Default] [Show] [Resize] [History] [Profile]