title: Java Applet, AWT Refresh, issue on Mac OS X 10.4
body: <p>We have a Java Applet built using AWT. This applet lets you select pictures from your hard drive and upload them to a server. The applet includes a scrollable list of pictures, which works fine in Windows, Linux and Mac OS X 10.5. We launch this applet via Java Web Start or within a web page. </p>
  
  <p>Our applet does not behave properly in Mac OS X 10.4, regardless of the version of Java (1.4 or 1.5). You can find a screenshot of the incorrect behaviour, when scrolling, here:</p>
  
  <p><a href="http://www.lavablast.com/tmp/ui_error.png" rel="nofollow noreferrer">http://www.lavablast.com/tmp/ui_error.png</a></p>
  
  <p>Simply put, sometimes when scrolling the pictures end up overlapping the header or footer of the application. This behaviour does not occur on other platforms. On Mac OS X 10.4, it shows the pictures in the incorrect location when scrolling, which would not be so bad if it refreshed the screen after painting the image at that location. However, it does not appear that the application knows it painted it incorrectly and thus does not refresh.</p>
  
  <p>If the window is minimized, resized or even moved, the application is refreshed and the incorrectly positioned elements vanish and the application resumes normally. I spent quite some time trying to force a refresh of the background image unsuccessfully. (the repaint the image directly, repaint all children of a few panels, etc. ) Thus, I am looking for any tips that would help me  resolve this problem under Mac OS X 10.4 or, in the worst case, simply simulate a full applet refresh. </p>
  
  <p>Until recently, everything was compatible with Java 1.1 but this has changed in a few locations which now require 1.4. I don't feel these changes created the issue, I am just providing this as extra information. If you are interested in implementation details of the scroll panel, I will investigate, but I am assuming this is a common platform bug for which workarounds must be known.</p>
  
  <p>To replicate the problem, open the following Java Web Start application:
  <a href="http://www.lavablast.com/tmp/opal-webstart.php.jnlp" rel="nofollow noreferrer">http://www.lavablast.com/tmp/opal-webstart.php.jnlp</a></p>
  
  <p>Select a folder containing lots of images and play with the scrollbar. At some point (fairly quickly), you should get the refresh problem. </p>
  
  <p>Edit: I followed the first suggestion here and replaced all my controls that feature background images with a Swing equivalent and the issue is still there. (Plus, there are numerous other fixes I would need to do to do a complete change). Any other ideas? A simple one line of code that forces a full refresh would be great :)</p>
  
  <p>Edit2: The main thread creates the panels and launches X threads. Using an observer/notifier pattern, the threads complete and notify the main control, which adds a panel to the page. This is done via an EventQueue.invokeLater which, unless I am mistaken, should run on the right thread. The issue is at its most severe when scrolling even if no extra threads are running (as during the loading).  </p>