Results 1 to 2 of 2
  1. #1
    Josep_16's Avatar
    Josep_16 is offline Member
    Join Date
    Mar 2011
    Rep Power

    Default Deprecated warnings?

    Hello. I was just trying to compile this applet (taken from a tutorial):
    Java Code:
     * Applet Ojo
     * <APPLET CODE="Ojo.class" WIDTH="300" HEIGHT="300">
     *   <PARAM NAME="Cadena" VALUE="Esto sí que es chulo">
     * </APPLET>
    import java.applet.Applet;
    import java.awt.*;
    public class Ojo extends Applet {
      int ancho, alto, anchoOjo, altoOjo, anchoPupila, altoPupila;
      int xOjo, yOjo, xPupila, yPupila, xActual, yActual;
      Image buffer;
      Graphics pantallaVirtual;
      public void init() {
        ancho = getBounds().width;
        alto = getBounds().height;
        anchoOjo = ancho / 2;
        altoOjo = alto / 2;
        anchoPupila = anchoOjo / 2;
        altoPupila = altoOjo / 2;
        xOjo = anchoOjo - anchoPupila;
        yOjo = altoOjo - altoPupila;
        xPupila = xOjo + anchoPupila/2;
        yPupila = yOjo + altoPupila/2;
        xActual = xPupila;
        yActual = yPupila;
        buffer = createImage(ancho, alto);
        pantallaVirtual = buffer.getGraphics();
      public void paint(Graphics g) {
        g.fillOval(xOjo, yOjo, anchoOjo, altoOjo);
        g.fillOval(xActual, yActual, anchoPupila, altoPupila);
      public void update(Graphics g) {
        Color colorTemporal = pantallaVirtual.getColor();
        pantallaVirtual.fillRect(0, 0, ancho, alto);
        g.drawImage(buffer, 0, 0, this);
      public boolean mouseMove(Event evt, int x, int y) {
        xActual = (xPupila*21 + x*8)/32;
        yActual = (yPupila*21 + y*8)/32;
        return true;
    When I imputed "javac" it sent me the next error:

    Java Code:
    Note: uses or overrides a deprecated API.
    Note: recompile with -Xlint:deprecation for details
    Recompiling with "javac -Xlint:deprecation" it says:

    Java Code: warning: [deprecation] mouseMove(java.awt.Event,int,int) in Java.awt.Component has been deprecated
             public boolean [B]m[/B]ouseMove(Event evt, int x, int y) {
    1 warning
    What's wrong with the code? Thanks!
    Last edited by Josep_16; 08-07-2011 at 12:20 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    On vacation
    Rep Power


    What's wrong with the code?
    The code is using OLD methods that the current JDK developers don't think should be used any more.
    Often that is because there are problems with using those old methods or because there are newer and better ways to do the job.
    If you read the API code for the deprecated methods, there will be recommendations for better techniques.

Similar Threads

  1. Warnings: Running Applet
    By sarwar1234 in forum New To Java
    Replies: 3
    Last Post: 11-11-2010, 11:44 AM
  2. Intellij-Hibernate persistance model warnings
    By eborix13 in forum IntelliJ IDEA
    Replies: 0
    Last Post: 04-20-2009, 08:58 PM
  3. Handling SQL Errors and Warnings
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-12-2008, 10:37 AM
  4. Getting warnings reported by Connection object
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-20-2008, 09:57 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts