• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable header and Look and Feel problem

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
need help in solving the following problems
1. i have a JTable that i want to display information in the table header from a JTextField am using to input data.please how do i handle it.

inputfield = new JTextField(20);

tablemodel = new DefaultTable();
tablemodel.addColumn("Number");
tablemodel.addColumn("Food Item");
tablemodel.addColumn("Quantity");
tablemodel.addColumn("Price");
tablemodel.addColumn("Description");

table = new JTable(tablemodel);

TableColumn column = null;
for (int i = 0; i < 5; i++) {
column = table.getColumnModel().getColumn(i);

if(i==0){
column.setPreferredWidth(65);
} else if(i==1){
column.setPreferredWidth(100);
} else if(i==2){
column.setPreferredWidth(65);
} else if(i==3){
column.setPreferredWidth(65);
} else{
column.setPreferredWidth(100);
}
}

2.need help in the Look and Feel of my JFrame have the look of a glass.please somebody tell to do this.

thanks in advance.
reply
    Bookmark Topic Watch Topic
  • New Topic