Forums Register Login

Lines and Images not drawing

+Pie Number of slices to send: Send
Hello fellow Ranchers! I'm having a problem with my program where the graphics are not drawing. I'm probabily missing something and I have spent alot of time trying to figure it out and haven't been successful.
This is an exercise for college,  which the objective is to simulate a car race. I haven't worked on the racing part as I have a similar code from a previous exercise, so I've started with having the graphics but it isn't working.
I have 4 classes: Race (the GUI), Track, Car and Main. I will post them below as well as the window that I get.
Thank you very much and I hope you all are having a wonderful day.
Dillon Colt









+Pie Number of slices to send: Send
 

it isn't working.  


Please explain.

How are you trying to debug the code to see what it is doing?  Try adding some print statements so you can see what methods are being executed.
+Pie Number of slices to send: Send
 

Norm Radder wrote:

it isn't working.  


Please explain.

How are you trying to debug the code to see what it is doing?  Try adding some print statements so you can see what methods are being executed.



I have no idea of how to debug it I've tried some stuff that didn't work. The problem is probabily in the track class but I have no idea what it is. That's why I posted it here
+Pie Number of slices to send: Send
 

I have no idea of how to debug it  


Start by adding calls to the System.out.println("a unique message text here") method in all the important methods in the code that need to execute for the code to work.  The print out will show you which methods are being called and which methods are not being called.   Then look closely at the methods that are not being called to see what the problem is.  If you find there are methods not being called and can't figure out why they  are not being called, post the names of the methods here.

Please explain what you expect to see that is not being shown.
+Pie Number of slices to send: Send
 

Norm Radder wrote:

I have no idea of how to debug it  


Start by adding calls to the System.out.println("a unique message text here") method in all the important methods in the code that need to execute for the code to work.  The print out will show you which methods are being called and which methods are not being called.   Then look closely at the methods that are not being called to see what the problem is.  If you find there are methods not being called and can't figure out why they  are not being called, post the names of the methods here.

Please explain what you expect to see that is not being shown.



Well it is solved. Turns out I was using paintComponents() but should be using paintComponent(). Thank you for your help!
This will take every ounce of my mental strength! All for a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2100 times.
Similar Threads
How to draw straight line instead of curved line??
JPopupButton
JComponent not opaque
Picture Woes
Applets Bars
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:49:00.