Q:

Retrieval of database values using component other than jtable?

is there any way to retrieve database rows using component other than jTable where unique jButtons for each row can added and made to perform specific task?
Currently I'm using the following code... jTable appears in a dialog box 
public static DefaultTableModel buildTableModel(ResultSet rs)
            throws SQLException {
        ResultSetMetaData metaData = rs.getMetaData();
        // names of columns
        Vector<String> columnNames = new Vector<String>();
        int columnCount = metaData.getColumnCount();
        System.out.println("7");
        for (int column = 1; column <= columnCount; column++) {
            columnNames.add(metaData.getColumnName(column));
        }
        // data of the table
        Vector<Vector<Object>> data = new Vector<Vector<Object>>();
        while (rs.next()) {
            Vector<Object> vector = new Vector<Object>();
            for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
                vector.add(rs.getObject(columnIndex));
            }
            data.add(vector);
        }
        return new DefaultTableModel(data, columnNames);
    }

    public void searchb2() throws SQLException {
        this.be_cgpa = be_cg.getText();
        this.maj_proj = Major.getText();
        this.h_percent = hss_percent.getText();
        this.s_percent = sss_percent1.getText();
        preparedStatement = con.prepareStatement("select name,age,gender,email_id,phone_num,state from resume1 where qualification='be' and be_cgpa>='" + be_cgpa + "'" + "and maj_proj_tech='" + maj_proj + "'" + "and hss_percent>='" + h_percent + "'" + "and sss_percent='" + s_percent + "'");
        ResultSet rs;
        rs = preparedStatement.executeQuery();
        JTable table = new JTable(buildTableModel(rs));
        JOptionPane.showMessageDialog(null, new JScrollPane(table));
    }

Can this code be modified to add jButton in each row?

A:

There is no reason you can't use JTable and add a column containing buttons to the table.
See Table Button Column for one way to do this. This class expects you to provide an Action that is invoked when the button is clicked. All you need to do is add another String of text to the "vector" after you have finished looping through the column data.
Also, use a PreparedStatement for your SQL. It is easier to code and understand and less error prone than your current code.

