posted 16 years ago
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.