title: Java: how to set .gif to the same size as the frame
body: <p>so I was messing around with a GUI and I wanted to challenge myself to display a gif. I ended up being able to do it but now I can't make the gif fit the entire frame instead of just a portion. I made the frame so you can't change the size and to be the same size as the monitor.</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import java.net.*;
  
  public class gif {
  public static void main (String[] args) throws MalformedURLException {
  
      URL url = new URL("http://stream1.gifsoup.com/view2/1605810/paranoid-android-o.gif");
      Icon icon = new ImageIcon(url);
      JLabel label = new JLabel(icon);
  
      JFrame frame = new JFrame();
  
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      label.setSize(screenSize);
      frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
      frame.getContentPane().add(label);
      frame.setTitle("what?");
      frame.setSize(screenSize);
      frame.setResizable(false);
      frame.setVisible(true);
  
      }
  }
  </code></pre>