I want to ask how to make frame can not drag when the application is running?
And then how to disable maximize, minimize button (title bar)?
I'm using JFrame
.
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);
来源:https://stackoverflow.com/questions/13467997/disable-drag-of-jframe