Results 1 to 2 of 2
Thread: Paint a Square`
- 12-01-2011, 09:49 PM #1Member
- Join Date
- Dec 2011
- Rep Power
Paint a Square`
I'm taking Java for the first time and I'm making a window that paints a square using the x & y coordinates of two mouse clicks within the frame, and then resets and repaints after two more clicks. The code can be found here:
[Java] package paintsquare; import java.awt.FlowLayout; import java.awt.Graphics; - Pastebin.com
When I compile I'm getting a blank window so I'm suspicious that I'm not even adding the JPanel to the JFrame properly.
With properly placed 'println's, I've noticed that my constructor isn't even assigning a 1 to clickCount, so I tried assigning it directly when defining clickCount just to get the ball rolling. The code IS assigning x and y coordinates, as shown from my println at line 63, so I've got that going for me, but still no rectangle! Any help is greatly appreciated.
Re: Paint a Square`
My experience here has been that folks get more help if they post their code here in the forum and use code tags when they do so.
- By gandalf5166 in forum New To JavaReplies: 20Last Post: 04-15-2010, 07:18 PM
- By joms999 in forum New To JavaReplies: 4Last Post: 02-25-2010, 07:55 AM
- By blindfolded in forum New To JavaReplies: 5Last Post: 01-22-2010, 05:58 PM
- By racewithferrari in forum New To JavaReplies: 2Last Post: 11-03-2009, 05:27 PM
- By racewithferrari in forum New To JavaReplies: 1Last Post: 11-01-2009, 10:16 PM