Grambot
Grambot

Reputation: 4514

Java Swing Applet redrawing garbage after mouse event

I'm having issues with my Java Swing Applet. I recently reformatted my computer and reinstalled Eclipse to continue work on my application but I'm having an issue when the screen redraws. Up until now the code has worked 100% (No issues) so I'm certain its an issue with my configuration settings.

The Applet will load fine but after any form of event the screen redraws to something like this: https://i.sstatic.net/4sX14.png

I'm using Eclipse Helios with pretty much a bare bones installation. Its configured to use jre6 but I have no idea why this occurs.

**Please also note that if I embed the applet in an html file it works fine! I however need the applet to run for various debug features I need while working on the AI

Upvotes: 2

Views: 229

Answers (2)

trashgod
trashgod

Reputation: 205775

Verify that you are constructing the GUI on the event dispatch thread. This is required for Swing applets, too.

Upvotes: 1

camickr
camickr

Reputation: 324088

Probably because you are missing a super,paintComponent(g) somewhere when you do custom painting.

Upvotes: 1

Related Questions