I'm using Borland JBuilder at work, and its GUI building tool
generates code that looks like this:
someImageIcon = new ImageIcon(MyAppMainFrame.class.getResource("Thing. PNG"));
I can replace "MyAppMainFrame.class" with "getClass()", and achieve
the same result, like so:
someImageIcon = new ImageIcon(getClass().getResource("Thing.PNG"));
This is how I would have written this line if I had done it by hand,
because I am not familiar with the .class construct. What exactly is
it? From the above usage it looks like a static field of the enclosing
class, which would mean that these other forms:
someImageIcon = new ImageIcon(this.class.getResource("Thing.PNG"));
someImageIcon = new ImageIcon(class.getResource("Thing.PNG"));
should also work, but both yield compiler errors. It's not documented
in the API, as far as I've been able to determine. Can someone explain
to me what this .class thing is, or at least point me to where it's
documented? Obviously, this isn't critical, it's just bugging me. :-)