Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JTable

 
Sergio Zuniga
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for the column names to appear, the table has to be added to a scrollpane.
 
Sergio Zuniga
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have something like this..



thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much !! that worked just fine..
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic