Reputation: 608
What does this code mean:
table = new JTable(){
public boolean isCellEditable(int arg0, int arg1) {
return true;
}
};
Upvotes: 3
Views: 99
Reputation: 425003
It's an anonymous class, which in this case has provided an implementation for JTable's isCellEditable method that always returns true
.
Upvotes: 4
Reputation: 258568
Think of it as:
class MyJTable extends JTable
{
public boolean isCellEditable(int arg0, int arg1) {
return true;
}
}
table = new MyJTable;
Upvotes: 2
Reputation: 92752
Whatever arguments you pass to isCellEditable
of this instance of JTable, it will always return true
. This is not the default behavior in JTable
, so you're overriding this behavior of your instance.
(If you meant "why would anyone do that", it should get you a JTable in which every cell is editable)
Upvotes: 0