0

I am trying to display some field of my database on a java front end using eclipse.

I have manage to display the entire table but I would like to do is to select some field of my database table as well as rename the field on my front end.

for example if there is a table called user with the fields(attributes) Name, age, height, weight,role. I would like my front end to display a table with two column Name and Role.

Sarah
  • 133
  • 1
  • 9

1 Answers1

1

Remove the columns that you don't want to see. Something like:

table.removeColumn( table.getColumn( "Weight" ) );

Or

TableColumnModel tcm = table.getColumnModel();
TableColumn tc = table.getColumn(3); // for the weight column
tcm.removeColumn( tc );
camickr
  • 321,443
  • 19
  • 166
  • 288
  • thanks but I am looking for a way by me passing an sql query to replace "select * from RQ"in my createable() method. I have tried to replace it with "select 'Name', 'Role' from RQ" but I end up with duplicate column header and no data displayed. – Sarah Mar 04 '13 at 21:19