I have a custom JComponent that performs come complicated painting. It is set to non-opaque so that the background of its parent shows through the parts it does not paint.
I need an mouse overlay (a simple shape) that follows the mouse. It really shouldn't need to repaint the component below it every time the mouse 开发者_JS百科moves. So I'm thinking to buffer the JComponent but because it's non-opaque, calling .paint(buffer) will not paint the background of the parent.
Any ideas?
Thanks in advance.
I have a custom JComponent that performs come complicated painting.
Maybe your complication painting can be done to a BufferedImage. Then the component just draws the image so you don't have to invoke the complicated code every time. The image would be recreated whenever properties affecting the image are changed.
May me you can use JWindow. Just make it visible and change position of the JWindow on mouse move?
精彩评论