title: Java2D and Swing Not Outputing Images with JFrames and JPanels
body: <p>I am working on the basics of a graphics program in swing and java2D to practice. I am having a problem wherein I cannot show my images. I have divided my code into 4 classes so that when the program gets larger it's easier to manage.</p>
  
  <p>The idea is that I have very little in the Main, that Frame initializes my first screen, that the screens can all be subdivided into their own classes, TitleScreen being one of these, and PullImage does all of the work of buffering and printing images which bothered me.</p>
  
  <p>When I run this I get an empty window and no errors, so I cannot figure out where the problem is.</p>
  
  <p>Please and Thank you for your help.</p>
  
  <p>Main</p>
  
  <pre><code>package com.game.pack;
  
  import javax.swing.JFrame;
  
  public class Main extends JFrame {
  
  private static final long serialVersionUID = 1L;
  
  public final static void main(String[] args) 
  {
  
      new Frame().initialize();
      new TitleScreen().openScreen();
  
  }
  }
  </code></pre>
  
  <p>Frame</p>
  
  <pre><code>package com.game.pack;
  
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  
  public class Frame extends JFrame{
  
  private static final long serialVersionUID = 1L;
  
  public final void initialize()
  {
      JFrame frame = new JFrame("Game");
      JPanel panel = new JPanel();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(800,600);
      panel.setSize(800,600);
      frame.setLayout(null);
      panel.setLayout(null);
      frame.setLocationRelativeTo(null);
      this.getContentPane().add(panel);
      panel.setVisible(true);
      frame.setVisible(true);
  }
  
  public final void close()
  {
      dispose();
  }
  
  }
  </code></pre>
  
  <p>TitleScreen</p>
  
  <pre><code>package com.game.pack;
  
  public class TitleScreen {
  
      public void openScreen()
      {
          new PullImage().printARGB("icons/titleBG.png",800,600,0,0);
          new PullImage().printARGBFromSheet("icons/titleButtons.png",
              200, 125, 400, 200, 200, 40, 0, 0);
          while (1!=2)
      {
  }
  </code></pre>
  
  <p>PullImage</p>
  
  <pre><code>package com.game.pack;
  
  import java.awt.Graphics;
  import java.awt.Image;
  import java.awt.image.BufferedImage;
  import javax.swing.ImageIcon;
  
  public class PullImage {
  
  public void printARGB(String source, int sizeX, int sizeY, int locX, int locY)
  {
      Image Icon = new ImageIcon(source).getImage();
      BufferedImage BuffedImage = new BufferedImage(sizeX, sizeY, BufferedImage.TYPE_INT_ARGB);
      Graphics graphics = BuffedImage.getGraphics();
      graphics.drawImage(Icon,locX,locY,null);
  }
  
  public void printARGBFromSheet(String source, int sizeX, int sizeY, int locX, int locY, int width, int height, int sheetLocX, int sheetLocY)
  {
      Image Icon = new ImageIcon(source).getImage();
      BufferedImage BuffedImage = new BufferedImage(sizeX,sizeY,BufferedImage.TYPE_INT_ARGB);
      Graphics graphics = BuffedImage.getGraphics();
      graphics.drawImage(Icon, locX, locY, locX+width, locY+height, sheetLocX, sheetLocY, sheetLocX+width, sheetLocY+height, null);
  }
  
  
  }
  </code></pre>