object - Java can't find symbol -


this error message

test.java:17: cannot find symbol symbol  : class mouseadapter location: class test         private class click extends mouseadapter                                     ^ test.java:19: cannot find symbol symbol  : class mouseevent location: class test.click                 public void mouseentered(mouseevent e)                                          ^ test.java:14: cannot find symbol symbol  : variable trayicon location: class test         trayicon.addmouselistener(new click());         ^ 3 errors 

import javax.swing.*; import javax.swing.event.*; import java.awt.*;  public class test extends jframe {      private jframe frame;      public void init()     {         trayicon.addmouselistener(new click());     }          private class click extends mouseadapter         {             public void mouseentered(mouseevent e)             {                 {                 frame.setvisible(true);             }         }     } } 

reproducing error:

$cat >test.java <<.  import javax.swing.*; import javax.swing.event.*; import java.awt.*;  public class test extends jframe {      private jframe frame;      public void init()     {         trayicon.addmouselistener(new click());     }          private class click extends mouseadapter         {             public void mouseentered(mouseevent e)             {                 {                 frame.setvisible(true);             }         }     } } . $javac test.java  test.java:15: cannot find symbol symbol  : class mouseadapter location: class test         private class click extends mouseadapter                                     ^ test.java:17: cannot find symbol symbol  : class mouseevent location: class test.click             public void mouseentered(mouseevent e)                                      ^ test.java:12: cannot find symbol symbol  : variable trayicon location: class test         trayicon.addmouselistener(new click());         ^ 3 errors 

adding import

$ed test.java  431 1i import java.awt.event.*; . wq 456 $javac test.java  test.java:13: cannot find symbol symbol  : variable trayicon location: class test         trayicon.addmouselistener(new click());         ^ 1 error 

declaring trayicon @ line 13

$ed test.java  456 13i         jlabel trayicon = new jlabel();// or makes sense . wq 528 $javac test.java  $ 

fixed!

resulting code:

$cat test.java  import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.*;  public class test extends jframe {      private jframe frame;      public void init()     {         jlabel trayicon = new jlabel();// or makes sense         trayicon.addmouselistener(new click());     }          private class click extends mouseadapter         {             public void mouseentered(mouseevent e)             {                 {                 frame.setvisible(true);             }         }     } } 

btw, don't need lines 26 , 21:

$ed test.java  633 26d 21d wq 605 $javac test.java  $ $cat test.java  import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.*;  public class test extends jframe {      private jframe frame;      public void init()     {         jlabel trayicon = new jlabel();// or makes sense         trayicon.addmouselistener(new click());     }          private class click extends mouseadapter         {             public void mouseentered(mouseevent e)             {                 frame.setvisible(true);             }         }     } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -