在编译时提示:(不知为何????)
E:\MyPractice\myjava\scr\ExchangeFrameByAction.java:111: myclass.ButtonActionListener is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
class ButtonActionListener implements ActionListener{
^
E:\MyPractice\myjava\scr\ExchangeFrameByAction.java:125: cannot resolve symbol
symbol : class currentCommand
location: class myclass.ButtonActionListener
if ((currentCommand) equals( FrameOne.getWeatherBtn))这段程序是这样写的(暂没用MVC,使用的是static var方式来处理)
//处理按钮监听事件
class ButtonActionListener implements ActionListener{
public JButton currentButton;
public String currentCommand;
public ButtonActionListener(JButton button){
currentButton = button;
}
public void actionPerformer(ActionEvent e){
currentCommand = e.getActionCommand();
if ((currentCommand) equals( FrameOne.getWeatherBtn))
ExchangeFrameByAction.frameTwo.show();
if ((currentCommand) equals (FrameTwo.getMessageBtn))
ExchangeFrameByAction.frameOne.show();
if ((currentCommand) equals (FrameOne.setWeatherBtn)){
FrameTwo.txtTwo.setText(FrameOne.txtOne.getText());
ExchangeFrameByAction.frameTwo.show();
}
if ((currentCommand) equals (FrameTwo.setMessageBtn)){
FrameOne.txtOne.setText(FrameTwo.txtTwo.getText());
ExchangeFrameByAction.frameOne.show();
}
}
}
E:\MyPractice\myjava\scr\ExchangeFrameByAction.java:111: myclass.ButtonActionListener is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
class ButtonActionListener implements ActionListener{
^
E:\MyPractice\myjava\scr\ExchangeFrameByAction.java:125: cannot resolve symbol
symbol : class currentCommand
location: class myclass.ButtonActionListener
if ((currentCommand) equals( FrameOne.getWeatherBtn))这段程序是这样写的(暂没用MVC,使用的是static var方式来处理)
//处理按钮监听事件
class ButtonActionListener implements ActionListener{
public JButton currentButton;
public String currentCommand;
public ButtonActionListener(JButton button){
currentButton = button;
}
public void actionPerformer(ActionEvent e){
currentCommand = e.getActionCommand();
if ((currentCommand) equals( FrameOne.getWeatherBtn))
ExchangeFrameByAction.frameTwo.show();
if ((currentCommand) equals (FrameTwo.getMessageBtn))
ExchangeFrameByAction.frameOne.show();
if ((currentCommand) equals (FrameOne.setWeatherBtn)){
FrameTwo.txtTwo.setText(FrameOne.txtOne.getText());
ExchangeFrameByAction.frameTwo.show();
}
if ((currentCommand) equals (FrameTwo.setMessageBtn)){
FrameOne.txtOne.setText(FrameTwo.txtTwo.getText());
ExchangeFrameByAction.frameOne.show();
}
}
}
解决方案 »
- 本人新手,请教一个问题(这是我第一个真正意义上的游戏啊)
- 用comm类读串口,同一次发送的数据分段了?
- 类与类之间的关系和操作?
- 我有一个java程序组 教授跟我说是对的 但是我不知道如何运行 跪求教!(内含代码)
- 请教高手关于可串化的详细解释
- 我想转移一个文件,但是这个文件现在正在被使用,我的程序就死在这里了,我要怎么避免这种情况啊?
- 请问大家在哪里能下载到jvm的源代码啊?(急问)
- ~~~!!!!~~~~~~~~~~!!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!真诚的请教!!!!!
- 怎么判断用户按下ctrl+c,ctrl+v
- 你一定可以帮我!
- 能回答问题者得100,先到先得!
- JTextField的字域为空时getText()的返回值是什么?
方法名写错了
提示下面是何原因:
E:\MyPractice\myjava\scr\ExchangeFrameByAction.java:123: cannot resolve symbol
symbol : class currentCommand
location: class myclass.ButtonActionListener
if ((currentCommand) equals( FrameOne.getWeatherBtn))
^
提示下面是何原因:
E:\MyPractice\myjava\scr\ExchangeFrameByAction.java:123: cannot resolve symbol
symbol : class currentCommand
location: class myclass.ButtonActionListener
if ((currentCommand) equals( FrameOne.getWeatherBtn))
^
if ((currentCommand) equals( FrameOne.getWeatherBtn))
应为
if (currentCommand.equals( FrameOne.getWeatherBtn))
提示下面是何原因:
E:\MyPractice\myjava\scr\ExchangeFrameByAction.java:123: cannot resolve symbol
symbol : class currentCommand
location: class myclass.ButtonActionListener
if ((currentCommand) equals( FrameOne.getWeatherBtn))
可能是
if ((currentCommand).equals( FrameOne.getWeatherBtn))
或者
if ((currentCommand).equals( FrameOne.getWeatherBtn()))
写错了,呵呵。