title: Displaying images and a text string simultaneously by button click
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12964639/how-to-display-images-on-jpanels-using-image-paths-in-netbeans">How to display images on JPanels using image paths in Netbeans</a>  </p>
  </blockquote>
  
  
  
  <p>I've prepared a GUI with buttons and Jpanels. When the buttons are clicked on in the JFrame, 3 things need to happen. Two large images (specified by a path from the Source Packages) must appear on two seperate JPanels, and a small string of text (that I will write) in an empty JLabel. The problem is that I can't figure out how I should write the button handling code. I also don't know if I need to implement some init components in order for it to work. Here's some sample code:</p>
  
  <pre><code>package db.SuperMarioGFX;
  
  import java.awt.image.BufferedImage;
  import java.io.File;
  import java.io.IOException;
  import javax.imageio.ImageIO;
  import javax.swing.ImageIcon;
  import javax.swing.JLabel;
  
  /**
   *
   * @author speterson86
   */
  public class EnemyGFX extends javax.swing.JFrame {
  
      /**
       * Creates new form EnemyGFX
       */
      public EnemyGFX() {
          initComponents();
      }
  
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       *
       * SuppressWarnings("unchecked"), followed by over 1000 lines of Generated
       * Code are below this, but not necessary to include in this code sample!
       */
      private void btnBeachKoopaActionPerformed(java.awt.event.ActionEvent evt) {
          // TODO add your handling code here:
          /**
           * For 'Land[JPanel]' (Panel-container for a set of buttons, not for
           * displaying images)
           *
           * Note that "pbx" is short for "picture box". Unlike VB, I couldn't
           * find any so-called picture boxes when I was building my GUI in
           * Netbeans, so I hoped JPanels would be the next best thing to use for
           * displaying relatively large (roughly 400 x 400 pixels or less each)
           * images. Now, here's the 3 things I need to display on my EnemyGFX
           * JFrame when the btnBeachKoopa button is clicked on:
           *
           * Display "GFX01.png" in pbxDefaultBinFile[JPanel] 
           * Display "Yoshi'sIsland2.zst, Level #$106" text in lblSaveState[JLabel] 
           * Display "Land1.PNG" in pbxFixedBinFile[JPanel]
           *
           * So how would I go about making that happen?...
           */
      }
  </code></pre>