I've spent most of today trying to better understand the two solutions provided by Henry and Craig. I tried a few different ways to combine them, but all failed. So, I decided to move on to the next phase of development -- enabling a variable number of thumbnail images to be shown in the QueuePanel. To do this, I decided to use a GridLayout and add a number of ImagePanels (one per grid element), and then use drawImage -- if there is an image for that panel -- or fillRect -- if there is no image for that panel. If there are fewer images than panels, the blank rectangles should go on the right portion of the screen.
In the version Henry provided, my modifications work fine when the JWindow is upright (0 degree rotation), but I couldn't make this work when the window is rotated 90 or 270 degrees. In the version that Craig provided, I could get it to work in all three rotation angles, but when it is rotated 270 degrees, the images are updated right to left (well, top to bottom). I tried using
but this didn't have any effect.
I'm posting the full version of the code below. Craig & Henry: if you're still paying attention to this
thread, the differences are
using a Thread in go()a new Runnable class, QueueMonitorrevisions to the QueuePanel class (GridLayout of ImagePanels)a new ImagePanel class Before posting the full code below, I'll note that the only differences between the modifications I made in Craig's version and those I made in Henry's version was the paintComponent() method in QueuePanel, which is not defined in Craig's version, and the paintComponent() in ImagePanel. In Henry's version, I use the following in QueuePanel
and the following in ImagePanel
Without further ado, the latest version is posted below. If anyone can help me figure out how to get the images in the QueuePanel to display left-to-right when the JWindow is rotated 270 degrees, I'd welcome any input. Other suggestions on how to better implement this are welcome, too. Thanks!
[Update: I had posted a subsequent message, to share the code I used to graphically explore the Graphics2D rotate() method; I deleted it for fear that
this message might not get seen (in such a long thread), and will repost that message later. I also inserted the modified paintComponent() method for ImagePanel from the version of Henry's code I modified.]
[Update 2: For now, I added a kludge so that the ImagePanels are added in reverse order to the QueuePanel when the rotation angle is 270 ... I updated the code above (with "kludge warning" comment), but would still welcome a more elegant solution and/or explanation as to why this would happen. Thanks!]
[ October 26, 2005: Message edited by: Joe McCarthy ]