• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

JTable emergency!!

 
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...
 
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);
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!