473,609 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What the heck is <ClassName>.cla ss?

I'm using Borland JBuilder at work, and its GUI building tool
generates code that looks like this:

someImageIcon = new ImageIcon(MyApp MainFrame.class .getResource("T hing.PNG"));

I can replace "MyAppMainFrame .class" with "getClass() ", and achieve
the same result, like so:

someImageIcon = new ImageIcon(getCl ass().getResour ce("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.getResour ce("Thing.PNG") );
someImageIcon = new ImageIcon(class .getResource("T hing.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 3393

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

Similar topics

2
6284
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 in the creation of classes derived from osg::Object, or osg::Node. The main reason these #MACROS are useful is because the cpp provides stringification of tokens in the source file. Here is what the META_Object #MACRO looks like: ...
0
1399
by: ma740988 | last post by:
Consider #include <iostream> #include <string> #include <map> using namespace std; struct dstream // data_stream class {
2
1141
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. If you create a temporary namespacename::classname() class to call thefunction(), at least that is what I understand of it, then would it not be more sense to make thefunction static? What the use of making thefunction virtual if you already...
16
4429
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 href="lemurs.html">Lemurs</a></li> <li><a href="chameleons.html">Chameleons</a></li> </ul> <ul>
14
2316
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 same style as the first row which I added by HTML. I do everything with the JavaScript what I do with HTML except that the added text with the JavaScript is not <h5 class = "style_tableentry_middle">Entry middle</h5> I guess it's only somehow...
16
9518
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> ....... ....... </ArrayOfClassname>
4
1263
by: giacomo.galilei | last post by:
I have this piece of code: abstract class Kaos { static $foo; abstract function MyFunc(); } ...
5
2720
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 item, the CSS properties, always applies to the last item in the list. How can i achieve this using JavaScript and the DOM?
2
3011
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 length. <html> <head> <title>Rapid Blocking Interface</title> <style> .calendar {
0
8133
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8573
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8547
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8224
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8406
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4026
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2535
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1676
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.