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

前端 未结 3 557
野的像风
野的像风 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:40

    Use the setUndecorated(true) property. Note that this has to be done before making the frame visible.

    JFrame frame = new JFrame();
    Toolkit tk = Toolkit.getDefaultToolkit();
    frame.setBounds(new Rectangle(new Point(0, 0), tk.getScreenSize()));
    frame.setUndecorated(true);
    frame.setVisible(true);
    

提交回复
热议问题