title: Show image in fullscreen in java
body: <p>I've been trying to display an image in fullscreen mode in java with JFrame but I can't get it to work.</p>
  
  <p>When I create a new object of this a white window opens in fullscreen mode but the image does not get displayed:</p>
  
  <pre><code>import java.awt.GraphicsDevice;
  import java.awt.GraphicsEnvironment;
  import javax.swing.ImageIcon;
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  
  public class DisplayManager {
  
      private JFrame jf;
  
      public DisplayManager() {
  
          //jframe
          jf = new JFrame();
          jf.setExtendedState(JFrame.MAXIMIZED_BOTH);
          jf.setUndecorated(true);
          jf.setVisible(true);
          jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
          GraphicsDevice device = env.getDefaultScreenDevice();
          device.setFullScreenWindow(jf);
  
          jf.add(new JLabel(new ImageIcon("E:/NetBeansProjects/Project/res/Test.png")));
  
      }
  
  }
  </code></pre>