File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Unable to display the JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Unable to display the JTable" Watch "Unable to display the JTable" New topic
Author

Unable to display the JTable

seema prakash
Ranch Hand

Joined: Nov 17, 2004
Posts: 59
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

Joined: Jul 15, 2003
Posts: 1078
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

Joined: Nov 16, 2004
Posts: 264
Have you tried displaying the table using a DefaultTableModel? Just to try to determine if the issue is in your custom tableModel?


-Tad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to display the JTable