user1481927
user1481927

Reputation: 81

JTable hidden under JScrollPane

I have a problem with JScrollPane - it looks like it lays over my JTable.

I have made a JTable without JScrollPane and everything seems to be fine - everything gets loaded as I wish and so on - but when I try to add JScrollPane everything goes wrong - only the column names are showing.

This is my code...

projectTable = new javax.swing.JTable();
ProjectTableModel ptm = new ProjectTableModel();
projectTable.setModel(ptm);

jScrollPane1.setViewportView(projectTable);

Is it a problem with positioning components? Could someone please help me with this problem.

Upvotes: 0

Views: 311

Answers (1)

Robin
Robin

Reputation: 36611

The Oracle JTable tutorial contains a section about 'Adding a table to a container', where the container in the example is a JScrollPane

Upvotes: 2

Related Questions