How can I create a Java Swing app that covers the Windows Title bar?

前端 未结 3 538
野的像风
野的像风 2021-01-06 02:35

I\'m working on a java swing application that will be used in a psychology experiment and the researchers have requested that I make the program \"black out the screen\" in

3条回答
  •  一生所求
    2021-01-06 02:47

    I know this thread is old but I found it while searching on how to do the same thing myself. I couldn't find any solutions I wanted to use so I came up with this. I found that the below solution not only works but is also much simpler than the above answers.

    JFrame frame = new JFrame();
    frame.setResizable(false);
    frame.setUndecorated(true);
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setSize(dim);
    frame.setVisible(true);
    

提交回复
热议问题