title: Clickable JButton in JTable, and want to know the row they have clicked
body: <p>I have a JButton inside a JTable in the last column, and when client click on that, It will show a JFrame. But I don't know how I can get the row so I can get the object in the row and send it to JFrame constructor?</p>
  
  <p>it is my table:</p>
  
  <pre><code>table = new JTable(model);
      JTableHeader tableHeader = table.getTableHeader();
      tableHeaderRenderer = table.getTableHeader().getDefaultRenderer();
      tableHeader.setDefaultRenderer(new TableCellRenderer() {
          private JLabel label;
          @Override
          public Component getTableCellRendererComponent(JTable table, Object value,
                  boolean isSelected, boolean hasFocus, int row, int column) {
              if (selectedColumn == value) {
                  label = (JLabel) tableHeaderRenderer.getTableCellRendererComponent(table,
                          value, true, true, row, column);
                  label.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
                  label.setBorder(BorderFactory.createCompoundBorder(label.getBorder(), 
                            BorderFactory.createEmptyBorder(0, 5, 0, 0)));
                  label.setHorizontalAlignment(SwingConstants.LEFT);
              } else {
                  label = (JLabel) tableHeaderRenderer.getTableCellRendererComponent(table,
                          value, false, false, row, column);
                  label.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
                  label.setBorder(BorderFactory.createCompoundBorder(label.getBorder(), 
                            BorderFactory.createEmptyBorder(0, 5, 0, 0)));
                  label.setHorizontalAlignment(SwingConstants.CENTER);
              }
              return label;
          }
      });
      table.getColumnModel().getColumn(3).setCellRenderer(new TableCellRenderer() {
          public Component getTableCellRendererComponent(JTable table, Object value,
                  boolean isSelected, boolean hasFocus, int row, int column) {
              JPanel buttonPanel = new JPanel(new BorderLayout());
              buttonPanel.setBackground(Color.white);
              JButton button = Shorter.button("Details", true);
              buttonPanel.add(button);
              return buttonPanel;
          }
      });
      table.getColumnModel().getColumn(3).setCellEditor(new TableCellEditor() {
          public boolean stopCellEditing() {return false;}
          public boolean shouldSelectCell(EventObject arg0) {return false;}
          public void removeCellEditorListener(CellEditorListener arg0) {}
          public boolean isCellEditable(EventObject arg0) {return true;}
          public Object getCellEditorValue() {return null;}
          public void cancelCellEditing() {}
          public void addCellEditorListener(CellEditorListener arg0) {}
          public Component getTableCellEditorComponent(JTable arg0, Object arg1,
                  boolean arg2, int arg3, int arg4) {
              JFrame frame = new JFrame();
              frame.setVisible(true);
              return null;}
      });
  </code></pre>
  
  <p>when frame loaded I want to know which row selected to add to frame constructor...</p>