
hi!
I want a table which looks like following can u tell me how it can be made with java swings..
YEAR 2005
Jan Feb Mar Apr May Jun July Aug Sep
pH
Phosphate
Chloride
BOD
COD
Can u tel me how i am able to make such table?
plz help.........

import javax.swing.*;
public class CreateJTable {
public static void main(String args[]) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object rowData[][] = { { "", "", "","","","","","","","","","" },
{ "", "", "","","","","","","","","","" } };
Object columnNames[] = { "Jan", "Feb", "Mar","Apr","May","June","Jul","Aug","Sep","Oct","Nov","Dec" };
JTable table = new JTable(rowData, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
frame.add(scrollPane);
frame.setSize(500, 150);
frame.setVisible(true);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.