I'm having problems drawing a rectangle, circle, and a straight line of a JFrame. I'm pretty sure I'm getting my coordinates off and I've spent hours trying to fix it which usually leads me to messing it up even more. If I somewhat fix one part of it, it just ends up messing up another part, so if anyone could help me out and show me what I am messing up it would be very much appreciated. The polygon part can be ignored, I will work on it once I get my coordinates fixed. Sorry if its a little long, I didn't know if I needed to attach all or just the part I'm having problems with so I went with the first. Thanks again.
Never use getGraphics of a Component, and don't perform custom painting in a top level window but rather in a JPanel or JComponent that is then added to the window.
There are no new questions, but there may be new answers.
Joined: Apr 11, 2011
Darryl Burke wrote:Never use getGraphics of a Component, and don't perform custom painting in a top level window but rather in a JPanel or JComponent that is then added to the window.
I know I needed a JPanel to do the painting on, but believe it or not that was the way my teacher recommended so I left out the extra work. I wish I had a teacher that knew java, but I've asked her many questions and she hasn't been able to answer any of them. I asked her the question I asked here before I posted it here and she couldn't help me. But thanks for pointing that out, I wish I had a more formal exposure but there's not much I can do about it.
subject: Using mouse clicks to draw on a JFrame, problem probably with coordinates