Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to display the JTable

 
seema prakash
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JTable which has the constructor as
myModel tableMap = new myModel(rows, colHeads);
jtable = new JTable(tableMap);

The rows is a vector of vectors with data like
[[Tom, 2343453456, JAVA, 20],[RITA, 4323453456, JAVA, 21]]

colHeads is the column headings like
[Name, Telephone, SkillName, Duration]

I add this JTable to the scrollerPane and the scrollerPane to JPanel
and then add the JPanel to the mainPanel.
Problem is I'm not able to see the JTable.
I am not sure what may be the reason. Any help is appreciated.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you set the scrollable viewport size?

Try adding jtable.setPreferredScrollableViewportSize(new Dimension(100, 100)) to your code and see if it shows up.
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried displaying the table using a DefaultTableModel? Just to try to determine if the issue is in your custom tableModel?


-Tad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic