Reputation: 1979
I want to create a class and extend it from JScrollPane than I want to add a customized table to it, I want to know is it possible or not? I put my sample code here
Can I create my table after I call super?
import javax.swing.*;
public class myJtableButton extends JScrollPane {
private JTable __table;
private JScrollPane __scrollPane;
private String TableName;
public myJtableButton(String TableName) {
super(__table);
__table = new JTable();
this.TableName = TableName;
}
}
Upvotes: 2
Views: 964
Reputation: 23629
Yes you can create such a class. Just don't call super in your constructor. Instead create your table and then set the view of the scroll bar like this:
setViewportView(table);
Upvotes: 4