title: Issues with using Java Method getImage() I created?
body: <p>So I'm attempting to create a simple application in which I can click a button and allow the user to display an image of their choice using a jFIleChooser from the menu and display that image into a label. I wrote code that works for that, but I'm supposed to create and use a method called "BufferedImage getImage()" using a class "ImageManipulator" to actually run that code, so that I can call on that method rather than running all the code in the main class. Here is what I have: (My ImageManipulator class)</p>
  
  <pre><code>public class ImageManipulator extends MainWindow {
  BufferedImage image;
  
  public ImageManipulator() {
      image = null;
  }
  
  public ImageManipulator(BufferedImage image){
      this.image = image;
  }
  
  public BufferedImage getImage() {
      FileChooser.showOpenDialog(null);
      BufferedImage image = null;
         try{
             File myFile = FileChooser.getSelectedFile();
  
             image = ImageIO.read(myFile);
  
             labelImage.setIcon(new ImageIcon(image));
         }
         catch(IOException e){
  
      }
      return image;
  
  }
  </code></pre>
  
  <p>and my main window for the GUI (the code that actually goes under buttonClicked):</p>
  
  <pre><code>private void buttonChooseActionPerformed(java.awt.event.ActionEvent evt) {                                             
  
  
          ImageManipulator myManipulator = new ImageManipulator(image);
          myManipulator.getImage();
  
  
  }   
  </code></pre>
  
  <p>So it presents an error because the image variable within myManipulator has not been declared or initialized. I realize that I need to initialize the image variable above in my main window and "connect" it to the image variable that is being returned via getImage() in some way, I'm just not sure about how to do so or what to set image equal to so that it actually runs the code in the getImage() method. I'm new to using classes and OO programming so hopefully someone can give me some direction here. </p>