This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
Problem with JTable
How to adjust the inner table width with the frame width
alternate rows in one color
some columns in different color of a table - help!
Multiple Level Sorting