1
我有点卡住了。我无法弄清楚比这个更大的问题,所以我要根深蒂固,最终建立我的路!组合框 - 打印出所选项目
我不能打印在组合框中选择的项目,目前我有一个ActionListener
它:
box.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt) {
myBox(evt);
}
});
...
protected void myBox(ActionEvent evt)
{
if(myBoxName.getSelectedItem().toString() != null)
System.out.println(myBoxName.getSelectedItem().toString());
}
我希望这我每次更改所选项目时打印到控制台,但事实并非如此。这应该是如此简单!
谢谢
你在哪儿叫'myBox'? – 2010-10-26 14:06:27
box.addActionListener(新的ActionListener(){ \t \t \t \t公共无效的actionPerformed(ActionEvent的EVT){ \t \t \t \t \t myBox上(EVT); \t \t \t \t} \t \t \t}); – tom 2010-10-26 14:09:46
我的变量不是真的叫这个,但它的工作数据,我不想冒任何机会 – tom 2010-10-26 14:10:16