recompile with -Xlint:unchecked for details
hi i am getting this compiler warning when compiling my code, i have looked around google and no one seems to have had this exact message.
here is my code if it helps:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
publicclass PaintPanelextends JPanelimplements MouseListener, MouseMotionListener
{
public Color currentColor = Color.BLACK;
public Point startPoint, endPoint;
public Vector vectors;
public PaintPanel()
{
vectors =new Vector();
addMouseListener(this);
addMouseMotionListener(this);
}
publicvoid mousePressed(MouseEvent e)
{
startPoint = e.getPoint() ;
}
publicvoid mouseReleased(MouseEvent e)
{
Vectors line =new Vectors(startPoint, e.getPoint(),true);
vectors.add(line);
startPoint =null ;
}
publicvoid mouseDragged(MouseEvent e)
{
Point endPoint = e.getPoint() ;
getGraphics().drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y) ;
startPoint = endPoint ;
}
publicvoid mouseExited(MouseEvent e)
{
}
publicvoid mouseEntered(MouseEvent e)
{
}
publicvoid mouseMoved(MouseEvent e)
{
}
publicvoid mouseClicked(MouseEvent e)
{
}
publicvoid paintComponent(Graphics g)
{
}
}
please help me, thanks
> hi i am getting this compiler warning when compiling
> my code, i have looked around google and no one seems
> to have had this exact message.
At the risk of sounding like I'm calling you a liar... that is not true. There are approximately 27.100 hits with an exact match with your topic title.
Anyway, did you actually, like it says, recompile with -Xlint:unchecked for details? If you do, you will find it points you exactly to the offending line(s). It will be in the area of declaration/use of your "Vector vectors".
Lokoa at 2007-7-12 1:59:18 >

> the nearest thing on google says ":deprecation for
> details"
Whatever. Your google must be having a bad day. Hint: enclosing your query with quotes ("your topic title") returns exact matches.
> when i compiled with -Xlint it just gave me a load of
> jargon i dont really understand. but it did point
> towards the line
> vectors.add(line)
Posting that jargon might help.
The cause is that you are using Java 1.5 or higher, and declare a Vector without specifying the type of elements it should hold. For example, if you want a Vector holding Strings, you should declare it as
Vector<String>
.
I'd advice you to google for "java generics tutorial" which would directly link you to Sun's tutorial, but... ;-p
Lokoa at 2007-7-12 1:59:18 >
