DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    Posts
    32

    HELP! for loops in the paint method

    Im trying to use the paint method to produce the following output:

    ______
    ______
    ______
    ______
    ______
    ______
    ______
    ______
    ______
    ______
    etc

    i have selected the correct pixels (co-ordinates) from where i want the first line and where i want the last line and i am trying to use a for loop so it does all the lines in one statement. (each line is 10 pixels apart)

    However, i cant seem to produce more than one line (the first line) and wondered if someone could show me exactly how to produce this. This is my code, if someone could edit that and show me i would be extremely grateful.


    Int startx, stopx, y;
    for(startx = 139; stopx <= 530; y=+10)
    {
    g.drawline(startx,y,stopx,y);
    }

  2. #2
    Join Date
    Sep 2004
    Posts
    223
    try this:


    Int startx, stopx, y, n = 0;
    for(startx = 139; stopx <= 530; y=+10)
    {
    g.drawline(startx,y + n,stopx,y + n);
    n += 25; // change this to the required distance between lines
    }

    can you show me what that does?
    A kram a day keeps the doctor......guessing

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links