when I use AWTUtilities.setWindowOpaque(this, false);
to make my JFrames' background transparent, you can change the location of my JFrame by dragging it an开发者_JAVA百科ywhere in the window. My problem is, that I have Objects I want to use for drag and drop on this Frame, but when the JFrame moves when I try to drag an object its impossible to drop it anywhere else.
Is there any way to solve this problem?
By the way, I am on Mac using Mac OS 10.6.6
Thanks for your help!
Sorry for the my bad english. Try this:
setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE);
By default the setWindowOpaque function set this client property as true. But this client property makes every component within your window draggable.
Now you have to make the drag code by yourself.
You should test that on windows as I think that's a mac feature. You can, in general click anywhere in the frame to drag an app about. What's your target deployment platform? Maybe you can put another panel in it and set that to non-opague. maybe this will help?
精彩评论