java - Retrieval of database values using component other than jtable? -


Text after "div class =" itemprop = "text">

There are other components used in addition to JTable where unique jButtons can be added for each line to be retrieved and performed database rows Is there any way to perform specific tasks?

Currently I'm using the following code ... JTable A Dialog Box

  Public Fixed DefaultTableModel buildTableModel (ResultSet RS) SQLException {ResultSetMetaData Metadata appears in Throws = Rs.getMetaData (); // Column Vector Name & lt; String & gt; ColumnNames = new vector & lt; String & gt; (); Int column = mountadata.gate columncount (); Println ("7"); {ColumnNames.add (metaData.getColumnName (column)) for (int column = 1; column & lt; = columnCount; column ++); } // data vector of the table & lt; Vector & lt; Object & gt; & Gt; Data = new vector & lt; Vector & lt; Object & gt; & Gt; (); While (rsnext ()) {Vector & lt; Object & gt; Vector = new vector & lt; Object & gt; (); {Vector.add (rs.getObject (columnIndex)) for (int column index = 1; column index & lt; = columnCount; columnIndex ++); } Data.ed (vector); } Return the new DefaultTableModel (data, column name); } Public Zero 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 ("Name, Age, Gender, EMAIL_ID, PHONE_NUM, Selection from state resume1 where qualification = 'be' and 'be_cgpa' = '' + be_cgpa + '" "+" and maj_proj_tech =' '+ maj_proj + "'" "And hss_percent & gt; ='" + h_percent + "'" + "and sss_percent ='" + s_percent + "''); Reset the result; Rs = ready. Exact (); JTable table = new JTable (Buildtable Model (RS)); Employmentpan Show Messagidoug (empty, new JScrollPane (table)); }  

Can this code be modified to add jButton to each line?

There is no reason why you can not use JTable and add columns containing buttons in the table .

Look for one of the ways to do this. This class expects you to provide a action , when the button is clicked. All you need to do is to add another string of text to "vector" after you have finished looping through the column data.

In addition, use a PreparedStatement for your SQL. It's easy to code and understand and prone to less error than your existing code.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -