Disable drag of JFrame

雨燕双飞 提交于 2019-12-06 09:04:31

Just add the below line it removes the window decorations like close maximise and minimise(titlebar). This itself disables the dragging only with mouse events.

frame.setUndecorated(true);
hoang nguyen

You can use a JWindow instead of a JFrame. There is no title bar, so the user won't be able to move it.

setResizable(false);
setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!