Paint() problem, AudioThumbnail

For some reason(most likely an obvious one!) the paint() method in my Thumbnail component(borrowed heavily from the Juce demo) won't display my loaded file until I manually force a repaint, by either clicking on it, or dragging it off and back on screen. I'm using ENABLE_DEBUG_REPAINTING and I can see that the component is being redrawn after I open a file but no waveform is showing. I placed checks into my paint routine and the drawChannels() method is definitely being called after I load a file. Here's what it looks like after I open a file.

Everything was the same colour as the outer colour surrounding the waveform component when the app loaded, so to me this would indicate that the component did in fact repaint itself, but where is the waveform? Here's what it looks like if I drag the window off-screen right and back and again:

I'm not really sure where to go with this. I've tried putting in repaint() calls all over the place, but there has to be a cleaner way. I'm must be missing something simple. If I open another file, once the waveform is being displayed correctly, everything works fine. Any ideas, suggestions?

You're probably repainting it before the thumbnail has been generated. Have another look at the demo, it is a ChangeListener and repaints itself as the thumbnail loads.

Thanks Dave, in the end I'm just going to 'appropriate' the class Jules wrote for the demo :) No point in reinventing the wheel, although much was learned in this exercise!