I have create a JFrame for my Login Screen. I need my JFrame to be Non Draggable. I tried the setUndecorated method. It makes the Jframe Non-Draggable. But I am not able to view the border of the Jframe and also the minimise, close buttons. So what is the alternative to achieve the same.

Recommended Answers

All 2 Replies

You can set the location of the Jframe under the mouse listeners so it will not move from that position

Hi,
I tried implementing the MouseMotionListener and in the method mouseDragged, i tried to set the location to the required dimensions. But still i was able to drag the JFrame, but when i tried to implement the ComponentListener, in method componenedMoved i tried setting the location to the required and it worked fine. Thanks for your reply

You can set the location of the Jframe under the mouse listeners so it will not move from that position

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.