diff --git a/core/src/main/java/com/github/weisj/darklaf/components/togglebuttonlist/JToggleButtonList.java b/core/src/main/java/com/github/weisj/darklaf/components/togglebuttonlist/JToggleButtonList.java index a8fa81f9..124041aa 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/togglebuttonlist/JToggleButtonList.java +++ b/core/src/main/java/com/github/weisj/darklaf/components/togglebuttonlist/JToggleButtonList.java @@ -89,22 +89,33 @@ public class JToggleButtonList extends JList { } public void addToggleButton(final int index, final JToggleButton item) { - gettogglebuttonModel().add(index, item); + getToggleButtonModel().add(index, item); } public boolean isSelected(final int index) { - return gettogglebuttonModel().get(index).isSelected(); + return getToggleButtonModel().get(index).isSelected(); } public void setSelected(final int index, final boolean selected) { - gettogglebuttonModel().get(index).setSelected(selected); + getToggleButtonModel().get(index).setSelected(selected); repaint(getCellBounds(index, index)); } - private DefaultListModel gettogglebuttonModel() { + private DefaultListModel getToggleButtonModel() { return ((DefaultListModel) getModel()); } + @Override + public void updateUI() { + super.updateUI(); + if (getModel() instanceof DefaultListModel) { + DefaultListModel model = getToggleButtonModel(); + for (int i = 0; i < model.getSize(); i++) { + model.get(i).updateUI(); + } + } + } + /** * Gets all the indices that are checked. *