Hi all, I am doing some swing game programming and I am at a bit of a loss right now as the AWT Event 0 thread ( I have system.out.printed its name) seems to be calling the same code twice, any ideas on this? I am overriding the paintComponent() of JPanel and using this method to draw my game canvas. when the player is called I am calling a method from paintComponent() that disposes the gameJFrame and then launches a new JFrame (a high score frame) - and the high score frame pops up twice!
I am not going to post code at this stage as I am still trying to detect the point at which the thread starts to call the same code twice. any help would be greatly appreciated as this has been a thorn in my side for a while now!
thedrones12
0
Newbie Poster
Recommended Answers
Jump to PostpaintComponent() can definitely be called often and you really shouldn't be creating any new components in that method. It should just handling painting the component to the screen. Perhaps you should pop up the other screen from whatever event ended play.
Edit: Just a note on the double call: …
All 4 Replies
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
thedrones12
0
Newbie Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
thedrones12
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.