开发者

How to set the JComboBox back to its default item

I have 24 JComboBox consisting of numbers, 2 JButton for "COMPUTE" and "CLEAR ALL". my COMPUTE BUTTON works just fine. But for the CLEAR ALL button I cant get my desired outcome. I would like to have the clear JButton to act when clicked, by returning all JComboBox to its default number 0. Please h开发者_Python百科elp. What would be the best code for this.


setSelectedItem(Integer.valueOf(0));

Give this in the event-handler of CLEAR ALL button.


jcombobox.setSelectedIndex(0); works fine than jcombobox.setSelectedItem(Integer.valueof(0); in different scenario

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜