So this is my code:
public void mouseMoved(MouseEvent e){
int mouseX = e.getX();
int mouseXout = MouseInfo.getPointerInfo().getLocation().x;
int width = pnlTrapIt.getWidth();
int mouseY = e.getY();
int mouseYout = MouseInfo.getPointerInfo().getLocation().y;
int height= pnlTrapIt.getHeight();
if(width < mouseXout && height < mouseYout) {
lblInfo.setText("The mouse is outside the program!");
}
}
Now what I want it to do is, apply this event to the entire screen resolution, as I want the program to do something when the mouse is outside the program's form. How can I apply this code to the entire screen even if the panel is smaller than the screen?