Can I do like
Or is there any another solution? Provided I only have a blank constructor (default).Code:Cell cell = new Cell() { public Cell() { this.setColumnSpan(3); }};
Printable View
Can I do like
Or is there any another solution? Provided I only have a blank constructor (default).Code:Cell cell = new Cell() { public Cell() { this.setColumnSpan(3); }};
No, you can't... The Java compiler will start a party
I would try it and see. You can do the exact same thing with actionlisteners so I don't see why not. Anynonymous classes are allowed.
That's an interface, there is a big difference.Quote:
Originally Posted by System_Error
Anonymous classes are allowed. If you think otherwise then you need a java certification book.
Neb, it seems that for an annoymous class to work you cannot have a named variable, so this should work:
So you can't have a name and theirs no way to refer to them. Probably not what you are looking for, but anonymous classes ARE legal.Quote:
new Cell() { public Cell() { this.setColumnSpan(3); }};
No, that's an inner class implementing an interface.. there's a big difference.Quote:
Originally Posted by ComputerJy
I'm good with thatQuote:
Originally Posted by System_Error
But implementing A CONSTRUCTOR -- NO WAY