I'm confounded by an error I'm getting when I try to use the setCursor() method from within a JPanel.
import javax.swing.*; import java.awt.event.*; import java.awt.Cursor; public class TestPanel extends JPanel { public TestPanel() { this.AddMouseListener(); } public void AddMouseListener() { this.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { this.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); } }); } }
When I try to compile this, I get the error:
Is there a Cursor class other than the java.awt.Cursor class? I can't find any trace of another Cursor in the Java API. Even then, why would they be incompatible?cannot find symbol - method SetCursor(java.awt.Cursor); maybe you meant: getCursor() or setCursor(Cursor)