0

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?

Theon144
  • 87
  • 1
  • 5

1 Answers1

3

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

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
Ashwinee K Jha
  • 9,187
  • 2
  • 25
  • 19
  • I had a suspicion there was a method like that, but for some reason I couldn't find it :) Thank you! – Theon144 Jan 12 '13 at 17:39