Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java homework - 12x12 grid

843785Oct 16 2008 — edited Oct 16 2008
Hi,

I need to create a 12x12 grid inside a frame and color the grid field when the mouse has clicked on it. There are a lot of ways how to do it but neither of them has proved to be adequate. The plan was to create JPanel, set GridLayout 12x12 and add Rectangles as elements to the panel. Now, the panel.add(rectangle) method is now working and I don't know why, this is my second year of programming with Java.

I tried to search the forum, seeking for similar problem but so far nothing. I'd appreciate help in form of guidance how to approach to the problem.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2008
Added on Oct 16 2008
31 comments
342 views