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
精彩评论