Question

I have a class that extends JTable, and I want to set it's AbstractTableModel, but the only way I can see how that's possible is by calling the JTable constructor using super.

However, I need to initialize some variables (that hold the table data) before I call the constructor, which seems not to be possible ("call to super must be first statement in constructor"). How can I do that?

Was it helpful?

Solution

You can set the model after constructing the super class (i.e. JTable) by using the method setModel().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top