How to avoid firing actionlistener event of JComboBox when an item is get added into it dynamically in java?

后端 未结 9 2278
广开言路
广开言路 2020-12-04 00:23

I need your suggestions and guidence on following task.

I have a frame which has two JComboBoxes supposed they are named combo1 and combo2, a JTable and other compon

9条回答
  •  悲哀的现实
    2020-12-04 00:30

    I kind of went the stupid simple route with this issue for my program since I am new to programming.

    I changed the action listeners to have a counter if statement:

    if(stopActionlistenersFromFiringOnLoad != 0){//action performed ;}

    Then at the end of the java program creation, I added 1 to the counter:

    topActionlistenersFromFiringOnLoad += 1;

提交回复
热议问题