Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AWT

 
DB Ekanayake
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I get the following form a Java Tut and compile on My Win Xp Mechine.
Compiler gives following massages:
Note: HowToWindow.java uses or overrides a deprecaed API.
Note: Recompile with -Xlint eprecation for details.

But it runs correctly and gives the particular out put

Please Help Me

Thanks

import java.awt.Frame;
import java.awt.Label;
public class HowToWindow extends Frame{
public static void main(String arg[]){
new HowToWindow();
}
HowToWindow(){
Label label;
label=new Label(" How To");
add(label);
pack();
show();
}
}
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a warning, not an error - that's why you have no problems running the code.

Sometimes certain methods or classes of the Java API are made "deprecated". That means they shouldn't be used any more, and that there is a better alternative for achieving the same goal.

If you compile with the "-deprecation" flag the compiler will tell you in detail which methods are deprecated. In this case it's the "show()" method. Generally, the javadocs of the deprecated methods/classes will tell you what you should use instead.
 
DB Ekanayake
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks Ulf

I Learned much about the Deprecation from JavaDocs.
show() is replaced by setVisible(boolean).
Now my codes work pretty.

Thanks

DB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic