• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I need help

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is Salil. I am trying to compile this applet below:
import java.awt.*;
import java.applet.*;
public class Applet3 extends Applet {
TextField textField;
public void init(){
textField= new TextField(20);
add(textField);
}
public void paint(Graphics g) {
String s = textField.getText();
g.drawString(s, 40, 50);
}
public boolean action (Event event, Object arg) {
repaint ();
return true;
}
}
But when I compile it, it gives me the following error:
Applet2.java uses or overrides a depricated API. Recompile with "-deprication" for details.
Could u please tell me where exactly is the bug.
I can view the applet in Appletviewer
Thanks,
Salil
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kajol,
Your applet is working properly without a problem. I used jdk1.1 for compiling the program. The message you are getting must be a warning for depricated API. I think this is related to implementing the action method..
JAVA2 requires to register this component as ActionListener on component which fires action events (refer to java documentation) instead of using the action method.

Kalidas.
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kalidas,
It was really helpfull.....cool.....can I some more details about you..I have seen u answering most of the queries....
Plese get back to me..
Thanks again
Kajol
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When compiling the above program, u may compile it with -d option which is used for all deprecated methods. In this case it won't give u any compile error.
 
That feels good. Thanks. Here's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic