In general, I ran into a strange problem. This code works without any complaints, but when I try to go to the full-screen game window in this case (PlayerUnknown's Battlegrounds), this program simply closes (there is nothing in the console), but if you do not call frame.repaint (); then the program works without problems. I really hope for help ...
import javax.swing.JFrame; public class MainClass { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(700, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); while (true) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } frame.repaint();//Это строка как-то на это влияет } } } 