title: Java: How to change an image in an image panel as determined by which radio button is selected
body: <p>I'm a java beginner, and my java skills suck on this. In my jframe, i have this jpanel(below) which draws the image. I want the image changed whenever a radiobutton(in another frame) fires an ItemEvent and click something like a save button that'll fire an ActionEvent. i intend this to be of use for a character-selecting interface, as in MMORPGs, etc. Image panel below is intended for weapon-selecting interface in my game.</p>
  
  <pre><code>class Weapons extends JPanel {
  
      private Image weaponimage = weapon2.getImage();
  
      @Override
      protected void paintComponent(Graphics g) {
      super.paintComponent(g);
  
          g.drawImage(weaponimage, 0, 0,  this);
      }
  }
  </code></pre>
  
  <p>weapon2 is an ImageIcon. thanks in advance.</p>