aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Problem with JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JTable" Watch "Problem with JTable" New topic
Author

Problem with JTable

Sergio Zuniga
Greenhorn

Joined: Nov 18, 2003
Posts: 12
I have a simple table model and the problem i have is that my table doesen't show the columns names(i have a String[] with te columns, and they are ok).. i don't know what happened..
The table shows OK, but the columnNames are not OK.
any ideas ??
thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
for the column names to appear, the table has to be added to a scrollpane.
Sergio Zuniga
Greenhorn

Joined: Nov 18, 2003
Posts: 12
I have something like this..



thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
depending on where you want the table added, one of these lines is wrong
add(scrollPane);
JPanel1.add(table);

either
add(scrollPane); or
JPanel1.add(scrollpane);

but not both

it could even be this
JPanel1.add(scrollpane);
add(JPanel1);

here's a simple example program

Sergio Zuniga
Greenhorn

Joined: Nov 18, 2003
Posts: 12
Thank you very much !! that worked just fine..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JTable
 
Similar Threads
Multiple Level Sorting
Problem with JTable
How to adjust the inner table width with the frame width
some columns in different color of a table - help!
alternate rows in one color