|
-
Struggling in creating chessboard!!
Hey,I wanna create chessboard(only) without swings as i am a new programmer.Plz see this and say wats wrong with this code and necessary corrections
import java.awt.*;
import java.applet.*;
public class board2 extends Applet
{
int i=0,j=0,a=0;
public void init()
{
for(i=150;i<550;i+=50)//coordinates
{
for(j=50;j<=450;j+=50)//coordinates
{
a++;
repaint();
}
}
}
public void paint(Graphics g)
{
if((a%2)==0)
{
g.setColor(Color.lightGray);
g.fillRect(i,j,50,50);
g.drawRect(i,j,50,50);
}
if((a%2)==1)
{
g.setColor(Color.black);
g.fillRect(i,j,50,50);
g.drawRect(i,j,50,50);
}
}
}
Similar Threads
-
Replies: 2
Last Post: 04-05-2002, 12:43 PM
-
By Scott in forum VB Classic
Replies: 2
Last Post: 11-07-2001, 03:07 PM
-
By neil in forum Database
Replies: 2
Last Post: 07-04-2001, 07:07 AM
-
By Lisa in forum VB Classic
Replies: 4
Last Post: 10-04-2000, 07:00 AM
-
By Lenny in forum VB Classic
Replies: 2
Last Post: 03-21-2000, 04:31 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks