Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
请问如何让应用程序运行时框架不能拖动?
然后如何禁用最大化,最小化按钮(标题栏)?
我正在使用JFrame.
JFrame
只需添加以下行,它会删除关闭最大化和最小化(标题栏)等窗口装饰。这本身仅通过鼠标事件禁用拖动。
frame.setUndecorated(true);
您可以使用 aJWindow而不是 a JFrame。没有标题栏,因此用户将无法移动它。
JWindow
setResizable(false); setUndecorated(true); getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);