lundi 26 septembre 2016

Usage of ArrayLists for JSwing components - eclipse

With my code beeing very long doing basically the same for every component just using a different index I decided to place them all in an ArrayList of the needed type.
My code should en-/disable JSpinners according to CheckBoxes beeing checked.

I made up a code like this:

private static void updateGUI(int index){

    boolean enabl = checkBoxes.get(index).isEnabled();
    System.out.println(enabl);
    spinners.get(index).setEnabled(enabl);  
//more irrelevant stuff done here
}

So I would just give the index of the used checkbox and it should update the JSpinner accordingly. I placed a line to output the current value of the checkbox, when it triggers the function but it always puts out true.

All the checkBoxes are placed in the ArrayList correctly and I cannot find the mistake. Any help is appreciated!




Aucun commentaire:

Enregistrer un commentaire