Difference between revisions of "For Tutorial 2"

From Progzoo
Jump to: navigation, search
(Drawing Squares)
(Drawing Squares)
Line 28: Line 28:
 
</shell>
 
</shell>
  
==Drawing Squares==
+
==Increase the gap==
 +
<question title='Horizontal Squares' imgOut='flag.png' width='105' height='105'
 +
  className="Raster" rows='10' level='1'>
 +
Increase the gap between the squares. You can do that by changing <code>5*i</code> to <code>10*i</code>
 +
 
 +
[[Image:sqfor22.png|frame|Row of Squares]]<prog lang="java"><![CDATA[
 +
static void drawFlag(Graphics g){
 +
  for (int i=0;i<5;i++){
 +
    g.drawRect(5*i, 45 ,8 ,8);
 +
  }
 +
}
 +
]]></prog> <answer lang="java"><![CDATA[
 +
static void drawFlag(Graphics g){
 +
  for (int i=0;i<5;i++){
 +
    g.drawRect(10*i, 45, 8, 8);
 +
  }
 +
}
 +
]]></answer> 
 +
</question>
 +
 
 +
==Horizontal Squares==
 
<question title='Horizontal Squares' imgOut='flag.png' width='105' height='105'
 
<question title='Horizontal Squares' imgOut='flag.png' width='105' height='105'
 
   className="Raster" rows='10' level='1'>  
 
   className="Raster" rows='10' level='1'>  

Revision as of 20:27, 24 September 2008

Increase the gap

Increase the gap between the squares. You can do that by changing 5*i to 10*i

Row of Squares
[Font] [Default] [Show] [Resize] [History] [Profile]

Horizontal Squares

Draw a horizontal row of squares

Horizontal Row of Squares
[Font] [Default] [Show] [Resize] [History] [Profile]