Disable window drag and drop

when I use AWTUtilities.setWindowOpaque(this, false); To make my JFrames background transparent, you can change the location of my JFrame by dragging it anywhere in the window. My problem is that I have objects that I want to use to drag and drop on this frame, but when the JFrame moves, when I try to drag the object, it cannot be dropped elsewhere. Is there any way to solve this problem?

By the way, I'm on a Mac using Mac OS 10.6.6

Thanks for your help!

0
source share
2 answers

Sorry for my bad english. Try the following:

 setUndecorated(true); AWTUtilities.setWindowOpaque(this, false); getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE); 

By default, the setWindowOpaque function sets this client property to true. But this client property makes every component in your window draggable.

Now you need to make the drag code yourself.

+6
source

You should check this on windows as I think the mac function. You can, in general, click anywhere in the frame to drag the application. What is your target deployment platform? Maybe you can put another panel in it and set it to be consistent. maybe this will help?

0
source

Source: https://habr.com/ru/post/912398/


All Articles