I'm trying to change my components properties. Like setting their alignment to right or left. I have 15 buttons on FlowLayout panel.
final FlowLayout exL = new FlowLayout(FlowLayout.LEFT, 2, 3);
    JPanel panel1 = new JPanel();
    panel1.setLayout(exL);
    aligncom.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            int x = aligncom.getSelectedIndex();
            switch (x) {
                case 0: {
                    exL.setAlignment(FlowLayout.LEFT);
                    break;
                }
                case 1: {
                    exL.setAlignment(FlowLayout.RIGHT);
                    break;
                }
            }
        }
    });
I have this part of my code. "aligncom" is my ComboBox. Since Java wants me to declare my exL variable final, I think I can't change my buttons' properties. Is there any way I can run this code ?
                        
I think I can't change my buttons' properties
No, that's not true. final applies to the variable, that's all. It doesn't prevent changes to the object.
In other words, this would be invalid:
exL = new FlowLayout(...); // Trying to change a final variable
... but calling setAlignment etc is absolutely fine.
                    See more on this question at Stackoverflow