aspose file tools*
The moose likes Beginning Java and the fly likes a simple question? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "a simple question?" Watch "a simple question?" New topic
Author

a simple question?

danesh far
Greenhorn

Joined: Nov 25, 2004
Posts: 15
I am a java beginner.I am trying to write a program to show some images on the screen and found one but could not undrestand this line :

Toolkit T=this.getToolkit();

what is the role of T object?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"T" is not an object, its a reference. It refers to the Toolkit object, which is an object that provides the link between AWT components and native implementations of those components.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
You should call methods on 'T', the reference to the Toolkit object, to do what you need to do.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
Karim,

Welcome to JavaRanch! Please adjust your display name to meet the JavaRanch Naming Policy.
You can change it here.

Thanks!
danesh far
Greenhorn

Joined: Nov 25, 2004
Posts: 15
Thank you for your answer but it is still unclear to me why we need a link between AWT components and native implementations of those components.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
You need a reference to the Toolkit because Java is platform independent and the Toolkit "translates" between your code and the native code of the system you are running on.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: a simple question?