I am trying to re initialize the JComboBox while tab switches from data updating page to page containing JComboBox my function is like this and it is called as well but doesn't work....
private void jTabbedPane2StateChanged(javax.swing.event.ChangeEvent evt) {
S开发者_JAVA技巧ystem.out.println("State change called");
String[] categories=controller.getCategories();
ComboBoxModel cmbModel1=new DefaultComboBoxModel(categories);
jComboBox1.setModel(cmbModel1);
jComboBox1.validate();
}
It seems that controller.getCategories() always returns the same results.
Try to rather use the focusGained event for the tab where your combo resides. The stateChanged event occurs with every tab click you make.
kingo is right with his comment, since can only guess when the code is incomplete.
精彩评论