title: How does this update a component without using an actionListener?
body: <p><a href="http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/IconDemoProject/src/components/IconDemoApp.java" rel="nofollow">Code in Question</a></p>
  
  <p>There isn't an actionListener for the image thumbnails, yet when clicked they update the image. </p>
  
  <p><a href="http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html#example" rel="nofollow">From this webpage.</a></p>
  
  <p>Edit:  I am currently importing images using JFileChooser and then creating a thumbnail and displaying the full image in a similar way to this, although not using ImageIcons. But would like to use this method so when I add an image it adds to the list and allows me to click the thumbnail to show that image.</p>
  
  <p>However mine using actionListeners to change when something is pressed but this doesn't and can't understand the code where it does.</p>
  
  <p>Thanks</p>
  
  <p>Edit2: </p>
  
  <p>Regarding the repaint option:</p>
  
  <h2>I have a class which extends component which then calls a repaint function.</h2>
  
  <pre><code>public class Image extends Component {
  
  private BufferedImage img;
  
  //Print Image
      public void paint(Graphics g) {
          g.drawImage(img, 0, 0, null);
      }
  }
  </code></pre>
  
  <h2>I then have a class with all my Swing components which call methods from other classes.</h2>
  
  <pre><code>Image importedImage = new Image(loadimageone.openFile());
  Image scaledImage = new Image();
  // Save image in Buffered Image array
  images.add(importedImage.getImg());
  // Display image
  imagePanel.removeAll();
  imagePanel.add(importedImage);
  imagePanel.revalidate();
  imagePanel.repaint();
  previewPanel.add(scaledImage);
  previewPanel.revalidate();
  previewPanel.repaint();
  </code></pre>
  
  <p>If I remove the revalidate or repaint it wont' update the image on the screen.</p>
  
  <p><strong>Edit 3:</strong></p>
  
  <p>This is the code on how I implemented the dynamic buttons:</p>
  
  <pre><code>//Create thumbnail
      private void createThumbnail(ImpImage image){
          Algorithms a = new Algorithms();
          ImpImage thumb = new ImpImage();
          //Create Thumbnail
          thumb.setImg(a.shrinkImage(image.getImg(), 75, 75));
          //Create ImageIcon
          ImageIcon icon = new ImageIcon(thumb.getImg());
          //Create JButton
          JButton iconButton = new JButton(icon); 
          //Create ActionListener
          iconButton.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  bottomBarLabel.setText("Clicked");
                  imagePanel.removeAll();
                  imagePanel.add(images.get(position)); //Needs Fixing
                  imagePanel.revalidate();
              }
          });
          //Add to previewPanel
          previewPanel.add(iconButton);
          previewPanel.revalidate();
          previewPanel.repaint();
      }
  </code></pre>