• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable emergency!!

 
Inuka Jayasekera
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've created a JTable using the JTable(Object[][] rows, Object[] columns) constructor. The data in the table shows fine and well. But I cannot get the Column headings to show... is there somethimg else I need to do after I have created the JTable??
The code is below in case... It is however a part of a project and I don't know how useful it will be...

The AnalysisPanel class extends JPanel and this is the constructor for it. It is in the AnalysisPanel that I would like the JTable to show (with the column headings).
Thanks in advance...
 
Jason Steele
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to change this:
add(table, BorderLayout.CENTER);
to this:
add(new JScrollPane(table), BorderLayout.CENTER);
 
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!