Jump to content
  • Advertisement
Sign in to follow this  
MickeyMouse

[java] Nasty repainting of my SWT windows

This topic is 4721 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I'm having a strange problems with my SWT based windows developed in Java 5.0 under Windows XP. When I'm running my SWT application and Opera at the same time, when Opera does mail check, my SWT windows with all components are completely repainted which results in nasty refreshing of the window. I get more nasty results when my application is running and screensaver is running for some time. Then, when I leave screensaver my application is repainted something like 20 times in a row, which makes my SWT application flicker for few seconds with that crazy repainting. I should add I didn't really mess with SWT repainting within my Java code. Did anybody notice the same nasty repaint thing? Or do you have an idea of what could it be? - Why my SWT window receives repaint request (I assume so) when Opera checks the mailbox? Thanks for any help with this.

Share this post


Link to post
Share on other sites
Advertisement
The OS is probably calling for the application to perform a repaint. You can disable this via "setIgnoreRepaint(false)".

If that doesn't work, then you might get things to work by writing code your "repaint(Graphics g)" method that checks whether your window has focus or not. If it doesn't have focus, have it skip the redraw.

Something like:


JFrame mainFrame = new JFrame()

...

public void repaint(Graphics g){
if(mainFrame.isFocusOwner())
paint(g);
else
{} //Don't repaint!
}


The key here is to figure out why "repaint" is getting called. If you figure that out, then the problem should be easilly fixed.

Share this post


Link to post
Share on other sites
Thanks for your reply!

I didn't try it though because my window does have focus when it receives repaint message from OS. But repaint is surely not needed.

I also noticed that the number of repaint events my window received when coming back from screensaver is proportional to the number of Opera mail checks when being in screensaver mode. So when it's 2 hours of screensaver running I get tens of repaints afterwards. And of course, my SWT window has focus :(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!