Hello Ranchers,
I need to draw a line between two JInternalFrames in a JDesktopPane.
I have created a subclass of JDesktopPane and added my line drawing into the paintComponent() method. The line is drawn, but when I am dragging the frames around, I get some very weird behaviour. Please look at the following two little screenshots:
This is with the desktoppane's dragMode set to LIVE_DRAG_MODE :
and this is with the dragMode OUTLINE_DRAG_MODE:
As soon as I release the frame I am dragging around, and resize the window, the line gets drawn correctly. I tried adding a swing Timer to call repaint() on the desktoppane more frequently, but this still gave me some weird results during dragging (although the correct line will now be drawn as soon as I release one of the frames)
Here is a quick sample code which should compile and give you an idea of my problem :
I put a gradient background color in there just to see how that responds to the dragging but this seems to be drawn very nicely during the frame dragging.
I am hoping someone might have some tips as to why I am having this problem.
It's not such a big deal but it looks so very ugly!
Thank you in advance for any help,
Steven