title: Get value from JTable to set into JTextField
body: <p>I try to get value from <code>JTable</code> to put into <code>JTextField</code> when clicking the mouse but it doesn't work. For instance when user selects a row from my table, <code>JTextField</code> populates with information that is at selected row dynamically.</p>
  
  <p>Also my <code>JTable</code> is in a <code>JScrollPane</code>. Also my table has a <code>DefaultTableModel</code>.</p>
  
  <pre><code>DefaultTableModel model = new DefaultTableModel(){
      public boolean isCellEditable(int row, int column){
          return false;
          }
      };
  private JTable jTable1 = new JTable(model);
  public Reservation() {
      try {
          jbInit();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  private void jbInit() throws Exception {
      this.getContentPane().setLayout( null );
      this.setSize( new Dimension(400, 300) );
      this.setTitle( "Rezervasyon" );
      jLabel1.setText("Kitap No: ");
      jLabel1.setBounds(new Rectangle(0, 185, 60, 15));
      jTextField1.setBounds(new Rectangle(60, 180, 70, 20));
      jLabel2.setText("Ogrenci No: ");
      jLabel2.setBounds(new Rectangle(165, 180, 65, 20));
      jTextField2.setBounds(new Rectangle(250, 180, 75, 20));
      jButton1.setText("Gonder");
      jButton1.setBounds(new Rectangle(135, 210, 75, 21));
      jButton1.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  jButton1_actionPerformed(e);
              }
          });
      jLabel3.setText("Ogrenci ID: ");
      jLabel3.setBounds(new Rectangle(5, 30, 100, 15));
      jTextField3.setBounds(new Rectangle(80, 25, 120, 20));
      jScrollPane1.setBounds(new Rectangle(5, 50, 350, 115));
      jScrollPane1.addMouseListener(new MouseAdapter() {
              public void mouseClicked(MouseEvent e) {
                  int row = jTable1.getSelectedRow();
                  String book = model.getValueAt(row, 0).toString();
                  jTextField1.setText(book);
                  System.out.println(book);
                  String stuID = model.getValueAt(row, 1).toString();
                  jTextField2.setText(stuID);
              }
          });
      jButton2.setText("Ara");
      jButton2.setBounds(new Rectangle(285, 25, 75, 21));
      jButton2.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  jButton2_actionPerformed(e);
              }
          });
      jScrollPane1.getViewport().add(jTable1, null);
      this.getContentPane().add(jButton2, null);
      this.getContentPane().add(jScrollPane1, null);
      this.getContentPane().add(jTextField3, null);
      this.getContentPane().add(jLabel3, null);
      this.getContentPane().add(jButton1, null);
      this.getContentPane().add(jTextField2, null);
      this.getContentPane().add(jLabel2, null);
      this.getContentPane().add(jTextField1, null);
      this.getContentPane().add(jLabel1, null);
      String header [] ={"Kitap No", "Ogrenci No"};
      for(int i = 0; i &lt; header.length; i++){
          model.addColumn(header[i]);
          }
  }
  </code></pre>