0
的状态我有设置在我的GUI的方法
然后,我有这样的一些其他类的对象使用EnumStates
CallmeClass obj;
,当我尝试设置状态与JComboBox中的这样
obj.setState(state.getSelectedItem());
我得到的编译错误
结果的枚举1.所需的状态,但找到的对象
所以我的问题是is there a way to make the setState take as argument state.getSelectedItem() withouth changing the return type of the method setState() or re declaring the enums in the gui
。谢谢。
尝试铸造state.getSelectedItem()来所需的状态对象 – MadProgrammer
向我们显示您的代码和确切的编译器错误消息。你所展示的三行代码已经没有多大意义了。 –