Sarah
Sarah

Reputation: 133

Selecting column from database table and renaming them in java

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.

Upvotes: 0

Views: 286

Answers (1)

camickr
camickr

Reputation: 324207

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 );

Upvotes: 1

Related Questions