where is the source code....??? ...am I ever confused....!!

D

David

Hi

I've been bouncing back and forth between languages,
and just when I think I might like Java after all, I run into
one of these things again.....

I don't know why I want to do this, but.....
I'm trying to determine exactly where the code comes
from when you implement the Toolkit.getDefaultToolkit()
method.

For example, I want to see the implementation of
Toolkit.getDefaultToolkit().getImage(String filename) ....
(I figure there must be a pile of interesting code in that
one).

In the source for Toolkit, the getDefaultToolkit() method
returns another Toolkit. It seems to use a series of
conditions to 'apply' a system specific class to the returned
Toolkit, which I assume then makes it all act like a 'real'
class (instead of a set of abstract methods).

I am getting the creepy feeling that some of the system
specific concrete class implementations might only be
included as compiled .class files, and the actual source
code is not available or something.
A search for "getImage(String filename)" in an unzipped
scr.jar file directory produced no results, other than the
single abstract method in Toolkit.
Nor did a search of the text in the entire JDK directory.
This leads me to believe it's just not there (unless I
have to try every combination of space char's and stuff..)

My question is, does anybody know where this source
code is hiding.

If this has been answered recently, please just point me
in the right direction. I didn't know I was going to want
to know this before so I wasn't looking then to see if
somebody else was going to ask about it......
......and now be damned if I can find it anywhere.....

Thanks if you can help!
David Otte
 
A

Andrei Kouznetsov

I've been bouncing back and forth between languages,
and just when I think I might like Java after all, I run into
one of these things again.....

I don't know why I want to do this, but.....
I'm trying to determine exactly where the code comes
from when you implement the Toolkit.getDefaultToolkit()
method.

try this:

System.out.println(Toolkit.getDefaultToolkit().getClass().getName());

then you know where to search.
if it starts with "sun." then no source code is available.
 
D

David

....hmmm....... I guess I never thought of that.......

.....like the song says, "....they give you this, but you pay for that.".
Not strictly true:
http://www.cs.duke.edu/csed/java/src1.3/sun/awt/SunToolkit.java

That's an older version, but you might find something more up to date if you
look around.

That's exactly what I was looking for (I still have JDK 1.3 anyway, can't
figure
that one all out let alone get a new one......).

Thanks for the help and quick replies!!!

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top