Teen Programmers Unite  


Return to forum top

how to draw grid

Posted by speed213 [send private reply] at May 31, 2003, 09:42:02 PM

i want to draw a grid of vertical and horizontal lines every
10 pixels and it makes a grid of boxes on the window.and the output should similar like graph paper.
and if i want to use drawLine method,how to do it. i know that's simple question, but i am just a beginner and so struggling about the assignment.please give me a hand.

Posted by Psion [send private reply] at May 31, 2003, 11:43:30 PM

You haven't mentioned the slightest thing about what language/environment/etc. you are using, rendering this question impossible to answer. You probably want to ask for help from an instructor for your class, anyway. TPU is aimed at people who code for fun, not at folks looking for quick homework help.

Posted by sphinX [send private reply] at June 01, 2003, 05:49:55 PM

Sounds like simple Java to me. Got your JFrame? Got your JPanel in your JFrame? Just use a couple for loops in the paintComponent method of your panel. That's all I'll say.

Posted by Psion [send private reply] at June 02, 2003, 09:29:47 AM

CodeRed's response deleted for violating rules about answering homework questions

Posted by CodeRed [send private reply] at June 02, 2003, 09:37:20 PM

Oh for the love of god, Psion. Maybe Ill just PM it to him then...

I don't want to rant, but with the way you talk about this website not helping people as much as you'd like it to one would think you would rather give a solution to a problem than dish out complaints about proper posting etiquette. Regardless of whether or not this was a homework problem he would still have learned from my code. Yes, he can learn it in a book or figure it out for himself, but programming is hard enough on beginners as it is, why not throw the newbies a bone once in a while?

Posted by Psion [send private reply] at June 03, 2003, 08:04:04 AM

Because the proper way to help with a question so basic as that is to determine by a step by step question-and-answer process where exactly he is stuck. This way you help show him the actually problem solving process, which must be unclear for him if he asks so simple a question. You can't do this on a web forum; hence, I recommended talking to a teacher. Often, class policies say that any student caught asking for help on the Internet will be automatically FAILED. This is another thing to worry about.

Posted by Neumann [send private reply] at June 03, 2003, 08:52:23 AM

One should also make some kind of effort before posting a problem on any forums. Nothing show he actually made an effort to solve this problem.

And he doesn't seem to care since he did not post anything back after his first question.

You must be logged in to post messages and see which you have already read.

Log on
Save for later automatic logon

Register as a new user
Copyright TPU 2002. See the Credits and About TPU for more information.