Class Level {
int value;
public String toString(){
if (value == 50)
return "中等";
else if .....
}
}JComboBox jcmb = new JComboBox();
Level m = new Level();
m.value = 50;
jcmb.addItem(m);
int value;
public String toString(){
if (value == 50)
return "中等";
else if .....
}
}JComboBox jcmb = new JComboBox();
Level m = new Level();
m.value = 50;
jcmb.addItem(m);
解决方案 »
- io流的关闭问题
- java初学者问题(Could not find the main class)
- 用swing做的界面,JLabel里面放的是时间,怎么才能让它实时的更新啊?
- 请问:与System.out.print()相对应的输入类是什么呢??
- 如何在JButton 设置“ENTER”快捷键.
- 为什么不能通过编译?很奇怪.求教高手.
- DataInputStream的readInt()函数如果读的是字符串它能转换成整数,请问这个整数和字符串编码有什么联系?怎么来的整数?
- 谁能说说java内存管理机制吗?
- getClass().getResourceAsStream("/a.xml")总是报空指针,求解
- 哪里能下载到java web server?
- 值传递还是引用传递?
- 运行是出错 原因为何?
能调用toString()函数吗?