Java找不到符号
这是我的错误消息
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);
}
}
}
}
This is my 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);
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要:
编辑:
并且您需要声明trayicon:
You need:
Edit:
and you need to declare trayicon:
重现错误:
在第 13 行添加声明
trayicon
的导入已修复!
结果代码:
顺便说一句,你不需要第 26 行和第 21 行:
Reproducing the error:
Adding the import
Declaring
trayicon
at line 13Fixed!
Resulting code:
BTW, you don't need lines 26 and 21:
添加到 mellamokb 中,您正在使用未在任何地方声明的变量 trayicon 。
因此添加
并声明trayicon
adding to mellamokb, you are using a variable trayicon which is not declared anywhere.
So add
and declare trayicon