如何在Java中阻止输入?

Riz*_*606 2 java

如何在Java应用程序运行时阻止键盘和鼠标的输入.就像我们使用BlockInput(1)阻止AutoIt中的输入一样,我也想在Java中做同样的事情.

DaM*_*oss 5

我只能回答挥杆申请.对于你的主框架你应该有这个

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

//or if you are using awt

 Frame frame = new Frame();
 frame.addWindowListener(new WindowAdapter() {
     // handle the window closing event here
  });
Run Code Online (Sandbox Code Playgroud)