如何关闭 X 按钮的可见性并禁用 alt + F4 功能 [英] How to turn off visibility of X button and disable alt + F4 function

查看:62
本文介绍了如何关闭 X 按钮的可见性并禁用 alt + F4 功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何将主应用程序窗口中的 X 按钮设置为 false 以及如何设置 Alt + F4 功能不可用或只是禁用它?

Can someone tell me how to set my X button in main application window visible to false and how to set Alt + F4 function not available or just disable it?

我添加了:

public ZalumView(SingleFrameApplication app) { 
    super(app); 
    initComponents(); 
    mainFrame = this.getFrame(); 
    mainFrame.setTitle("Zalum - zarzadzanie zasobami ludzkimi"); 
    mainFrame.pack(); 
    mainFrame.setResizable(false); 
    mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

推荐答案

框架可能会使用 setUndecorated 关闭其原生装饰(即框架和标题栏)."—Frame

"A frame may have its native decorations (i.e. Frame and Titlebar) turned off with setUndecorated."—Frame

附录:您可以发送一个 WINDOW_CLOSING 事件并将该 Action 绑定到您想要的 Keystroke,如下所示 这里.

Addendum: You can send a WINDOW_CLOSING event and bind that Action to your desired Keystroke, as shown here.

这篇关于如何关闭 X 按钮的可见性并禁用 alt + F4 功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆