Java Swing JFrame为覆盖禁用鼠标悬停

Java Swing JFrame为覆盖禁用鼠标悬停,java,swing,jframe,overlay,mouse,Java,Swing,Jframe,Overlay,Mouse,我正在尝试使用swingJFrame为csgo制作一个覆盖图 我已经完成了我需要的一切,但是有一个小错误我无法修复。我到处都找过如何修复它,但我想不出来 每当我将鼠标悬停在正在渲染的任何对象上时,它都会使我的鼠标聚焦,并将我从游戏中拉出来 package com.rigadrinksbleach.csgo.external.overlay; import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; i

我正在尝试使用swingJFrame为csgo制作一个覆盖图 我已经完成了我需要的一切,但是有一个小错误我无法修复。我到处都找过如何修复它,但我想不出来

每当我将鼠标悬停在正在渲染的任何对象上时,它都会使我的鼠标聚焦,并将我从游戏中拉出来

package com.rigadrinksbleach.csgo.external.overlay;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;

import com.rigadrinksbleach.csgo.external.Start;
import com.rigadrinksbleach.csgo.external.hack.Hack;

public class ExternalOverlay extends JFrame {

public ExternalOverlay() {
    super("Overlay");
    this.setUndecorated(true);
    this.setBackground(new Color(0, 0, 0, 0));
    this.setBounds(0, 0, 1920, 1080);
    this.setAlwaysOnTop(true);
    this.getContentPane().setLayout(new java.awt.FlowLayout());
    this.setVisible(true);
}

public void loop() {
    this.repaint();
}

public void draw(Graphics g) {
    for(Hack hack : Start.getHacks().getHacks()) {
        hack.draw2d(g);
    }
}

@Override
public void paint(Graphics g) {
    super.paint(g);
    //g.setColor(new Color(255, 0, 0));
    //g.drawRect(0, 0, this.getBounds().width - 1 - this.getBounds().x, this.getBounds().height - 1 - this.getBounds().y); //debug border
    this.draw(g);
}

}
任何帮助都将不胜感激。

我知道解决方法。
只需将setVisible更改为False。

尝试使用frame.setFocusablefalse;这不起作用:/