title: JTable selection listener
body: <p>I have a code which displays Table in applets &amp; consists of two columns:-</p>
  
  <ol>
  <li>image icon </li>
  <li>description</li>
  </ol>
  
  <p>Here's my code:</p>
  
  <pre><code>    import javax.swing.table.*;
  
      public class TableIcon extends JFrame
       {
      public TableIcon()
      {
      ImageIcon aboutIcon = new ImageIcon("about16.gif");
      ImageIcon addIcon = new ImageIcon("add16.gif");
      ImageIcon copyIcon = new ImageIcon("copy16.gif");
  
      String[] columnNames = {"Picture", "Description"};
      Object[][] data =
      {
          {aboutIcon, "About"},
          {addIcon, "Add"},
          {copyIcon, "Copy"},
      };
  
      DefaultTableModel model = new DefaultTableModel(data, columnNames);
      JTable table = new JTable( model )
      {
          //  Returning the Class of each column will allow different
          //  renderers to be used based on Class
          public Class getColumnClass(int column)
          {
              return getValueAt(0, column).getClass();
          }
      };
      table.setPreferredScrollableViewportSize(table.getPreferredSize());
  
      JScrollPane scrollPane = new JScrollPane( table );
      getContentPane().add( scrollPane );
  }
  
  public static void main(String[] args)
  {
      TableIcon frame = new TableIcon();
      frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
      frame.pack();
      frame.setVisible(true);
    }
  
  } 
  </code></pre>
  
  <p>Now what i want to know is how can I implement selection listener or mouse listener event on my table , such that it should select a particular image from my table and display on text area or text field(my table contains path of image file)? </p>
  
  <p>Can I add text field on table &amp; table on frame?  Please feel free to ask queries if required.</p>