JPanel repaint() Issue

X

Xiaolei Li

Hi,

I'm having an issue with repaint() on a class that extends JPanel.
Basically, the JPanel should repaint itself based on a mouse movement in
another panel (call it X). Everything works properly on my Linux
machine but when I try the same code on my Mac OSX machine, it doesn't
repaint properly.

When the mouse is moved into the proper place in X, the JPanel I want to
repaint does something weird. The area that should change (it draws
some text) changes into this gray shade so it is drawing something.
The JPanel changes its size properly, and the MouseMotion stuff works
correctly, too. If I just resize the entire window or minimize/maximize
it or scroll, the text will show up correctly.

In my code, I just call revalidate() and repaint() on the JPanel. I
did not overwrite those methods, only paintComponent(). TIA.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top