-
Implementing a random color..
I have written this program but I now need to modify it so that if plots each line inside the for loop in a random color:
import java.awt.*;
import java.applet.Applet;
public class Lines1 extends Applet
{
public void paint(Graphics g)
{
g.drawLine(0,0,100,50);
g.setColor(new Color(255,0,0));
g.drawLine(50,75,200,25);
g.drawLine(50,75,200,26);
g.setColor(new Color(0,255,0));
for (int y1=120;y1<200;y1++)
{
g.drawLine(100,y1,200,y1+20);
}
}
}
Once again, any help is much appreciated.
Cheers
Steve
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