C
cbongior
I have recently begun to experiment more with Anonymous Inner classes
(I still consider them a devils deal). However, I did come upon a
situation where it was nice:
JPanel myPanel = new JPanel() {
public String toString() { return "Default";}
};
I used this so I could added panels to my JComboBox and swap them on
and off of another portion of the display. However, my hopes were
dashed when I wanted that Anonymous Inner Class to implement and
interface.
JPanel myPanel = new JPanel() implements QueryFormatter {
public String toString() { return "Default";}
public String getFormat() {return "";} // interface method.
};
I got an unexpected token compile error. So, is it possible to do this
with anonymous inner classes? I am thinking not, judging by the
compiler errors and the fact that the lanaguage specification is silent
on this.
Comments?
Christian
http://christian.bongiorno.org/resume.PDF
(I still consider them a devils deal). However, I did come upon a
situation where it was nice:
JPanel myPanel = new JPanel() {
public String toString() { return "Default";}
};
I used this so I could added panels to my JComboBox and swap them on
and off of another portion of the display. However, my hopes were
dashed when I wanted that Anonymous Inner Class to implement and
interface.
JPanel myPanel = new JPanel() implements QueryFormatter {
public String toString() { return "Default";}
public String getFormat() {return "";} // interface method.
};
I got an unexpected token compile error. So, is it possible to do this
with anonymous inner classes? I am thinking not, judging by the
compiler errors and the fact that the lanaguage specification is silent
on this.
Comments?
Christian
http://christian.bongiorno.org/resume.PDF