473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

What the heck is <ClassName>.class?

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. :-)
Jul 17 '05 #1
0 3361

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven T. Hatton | last post by:
I've been working a lot with OpenSceneGraph lately. Overall it is very much in the spirit of C++. One feature OSG has which is, IMO, an eyesore, is the presence of a couple of #MACROs to assist...
0
by: ma740988 | last post by:
Consider #include <iostream> #include <string> #include <map> using namespace std; struct dstream // data_stream class {
2
by: My4th | last post by:
I am looking in some old code of someone who's gone. Why should one use something like namespacename::classname().thefunction()? He repeatedly does that. The function is virtual and not static....
16
by: michael | last post by:
Is it possible to get all href URLs contained in a unordered list and place them in an array? Or in fact two different arrays, differently named one for each <ul> group? <ul> <li><a...
14
by: Stefan Mueller | last post by:
With the following code I can add a new row to an existing table. That really works great. Many thanks to all who helped me so far. But my problem is that the added cells do somehow not have the...
16
by: Bob Rock | last post by:
Hello, when serializing an array of elements of a class Classname using XmlSerializer.Serialize() I get an XML like the following: <?xml version="1.0"> <ArrayOfClassname> ....... ..........
4
by: giacomo.galilei | last post by:
I have this piece of code: abstract class Kaos { static $foo; abstract function MyFunc(); } ...
5
by: SM | last post by:
Hello, I have an <ul>, and when i click on a item i want to add a class to that item. The class itself will change some display properties, using CSS. See code below. But, whenever i click on a...
2
by: markszlazak | last post by:
I'm a relatively slow response of table cells changing their background color with mouseover/our in IE6 (Win 2K) but the response is fine (fast) in Firefox. Why? The code is below. Sorry about the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.