Results 1 to 2 of 2
Thread: Deprecated warnings?
- 08-07-2011, 12:00 AM #1
Deprecated warnings?
Hello. I was just trying to compile this applet (taken from a tutorial):
When I imputed "javac Ojo.java" it sent me the next error: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.setColor(Color.yellow); g.fillOval(xOjo, yOjo, anchoOjo, altoOjo); g.setColor(Color.black); g.fillOval(xActual, yActual, anchoPupila, altoPupila); } public void update(Graphics g) { Color colorTemporal = pantallaVirtual.getColor(); pantallaVirtual.setColor(Color.white); pantallaVirtual.fillRect(0, 0, ancho, alto); pantallaVirtual.setColor(colorTemporal); paint(pantallaVirtual); 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; repaint(); return true; } }
Recompiling with "javac -Xlint:deprecation Ojo.java" it says:Java Code:Note: Ojo.java uses or overrides a deprecated API. Note: recompile with -Xlint:deprecation for details
What's wrong with the code? Thanks!Java Code:Ojo.java:47: 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 warningLast edited by Josep_16; 08-07-2011 at 12:20 AM.
- 08-07-2011, 12:52 AM #2
The code is using OLD methods that the current JDK developers don't think should be used any more.What's wrong with the code?
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
-
Warnings: Running Applet
By sarwar1234 in forum New To JavaReplies: 3Last Post: 11-11-2010, 10:44 AM -
Intellij-Hibernate persistance model warnings
By eborix13 in forum IntelliJ IDEAReplies: 0Last Post: 04-20-2009, 08:58 PM -
Handling SQL Errors and Warnings
By Java Tip in forum Java TipReplies: 0Last Post: 02-12-2008, 09:37 AM -
Getting warnings reported by Connection object
By Java Tip in forum Java TipReplies: 0Last Post: 01-20-2008, 08:57 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks