Following is snap of my ChangeListner method, when i run my project, before i actually reach to tabbedPan the JOptionDialog pops out(actually along with jframe loads)! My actual purpose is i want to listen the changing of tabs so that i can load some contents on that tab from database! help me
jTabbedPane1.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent evt) {
jtabpanChangeListner(evt);
}
});
private void jtabpanChangeListner(ChangeEvent evt) {
// TODO add your handling code here:
int index = jTabbedPane1.getSelectedIndex();
String msg = jTabbedPane1.getTitleAt(index);
System.out.println("Tab changed to: " +msg);
JOptionPane.showMessageDialog(jTabbedPane1,"hello change me do you?+");}