Java bug in a multi monitor application
843810Mar 24 2004 — edited May 24 2005Hi,
I am developing an application using three monitors on windows platform. I am using a NVidia GeForce 4 card to derive the monitors. My application opens up in a secondary monitor, It consists of a Canvas whose parent is a JScrollPane, a JTree whose parent is another JScrollPane. The problem is if I load an image on the canvas and slide the scrollbars attached to the canvas, The canvas does not repaint itself, for which I had to add a listener which repaints the canvas each time the scrollbars are slided. Similar problem is with the JTree scroller, so I call the UpdateUI for the jtree each time the scroller is slided. A few days ago I added a JCombobox to my application. When i click it, obviously a dropdown menu appears with a slider. When i move the slider, the JComboBox does not repaint and I am having difficulty capturing the combobox's slider event. That's not all, I also experienced the repaint problem with other swing components for which I have to explicitly call the UpdateUI method. I got to a point that I had to literally call the update method for every swing component I am using which is dropping my applications efficiency. So I changed my monitor's setting and assigned my secondary monitor as the primary monitor using the windows display properties and it worked. The scrollbars work, and everything is repainting. So the solution is to change my display setting programatically so that the secondary monitors becomes the primary monitor, but I am not able to do that. I need some help regarding this.
If I have three monitors on a single computer, and I want to change the secondary monitor to primary, how can I do it using Java?
I hope I explained the problem. I hope someone has an answer.
Babar Noor