非法启动表达式public void itemStateChanged(ItemEvent e) [英] illegal start of expression public void itemStateChanged(ItemEvent e)

查看:162
本文介绍了非法启动表达式public void itemStateChanged(ItemEvent e)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码继续非法启动表达式错误。在底部包含错误消息。

This is my code that keeps on having the illegal start of expression error. Have included error messages at the bottom.

展开 | 选择 | Wrap | 行号

推荐答案

您错过了收盘使用public void itemStateChanged ...
You are missing a closing brace for your init method before the line with public void itemStateChanged ...


之前你的init方法的大括号,这里有另一个错误你可以帮帮我吗?

and here''s another error can you help me?

展开 | 选择 < span class =codeDivider> | Wrap | 行号


尝试从给出的错误消息中推断出问题。

例如,它说方法类Button中的addActionListener不能应用于给定的类型并且稍后说t1不能转换为ActionListener。所以你试图添加一个动作监听器但不传入一个动作监听器,因为你的类t1不是一个动作监听器。

你可以通过添加ActionListener来使它成为一个动作监听器接口

Try to deduce the problem from the error message given.
e.g It says method "addActionListener in class Button cannot be applied to given types" and says later that "t1 cannot be converted to ActionListener". So you are trying to add an action listener but not passing in an action listener because your class t1 is not an action listener.
You can make it an action listener by adding ActionListener to it''s implemented interfaces

展开 | 选择 | Wrap | 行号


这篇关于非法启动表达式public void itemStateChanged(ItemEvent e)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆