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.

6 Years
Discussion Span
Last Post by ajacintha

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.