Swing Table problem

C

Colin

I am using Sun's Swing Tutorial, and the page about the JTable seems
to indicate that if I define a class that extends AbstractTableModel,
I can then just write "JTable table = new JTable(new myTableModel());"
and the table should be displayed when I add it to a panel or frame.
I have done this, and for some reason my table has no column names at
the top. My class that extends AbstractTableModel implements the
getColumnName(int) function. The data cells are fine, I just need to
display the column headers.

Thanks,
Colin
 
C

Colin

I discovered the problem. I was not using a scroll panel for the
table, so I needed to explicitly add the table header as a component.

Thanks,
Colin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top