crazykid080 14 Author Posted November 6, 2020 I decided to throw it into my main class and I added some more debugs doneButton.addActionListener(e -> { log("Fired"); if (itemCB.isSelected()) { log(Item); utils.items.add(Item); } if (ItemBCB.isSelected()) { log("ItemB"); utils.items.add("ItemB"); } if (itemCCB.isSelected()) { log("ItemC"); utils.items.add("ItemC"); } if (itemDCB.isSelected()) { log("ItemD"); utils.items.add("ItemD"); } if (itemECB.isSelected()) { log("ItemE"); utils.items.add("ItemE"); } if (itemFCB.isSelected()) { log("ItemF"); utils.items.add("ItemF"); } }); Oddly enough, despite having multiple options selected it only gets through one. I think the issue is the List#add call
holic 237 Posted November 6, 2020 42 minutes ago, crazykid080 said: Fixed it. Lesson learned: Use ArrayList, not List. Nice. I didn't catch that you hadn't initialized it. List = new ArrayList<>() would have worked as well.
crazykid080 14 Author Posted November 6, 2020 6 minutes ago, holic said: Nice. I didn't catch that you hadn't initialized it. List = new ArrayList<>() would have worked as well. Yeah. All that suffering and confusion for something so simple. Oh well, live and learn
holic 237 Posted November 6, 2020 If you're using IntelliJ, when you hit an issue like this press F2 and it should highlight bits of code that pose potential problems or can be simplified. I think I mentioned it to you before, its good advice 98% of the time but sometimes it fucks your code and it'll be obvious when it does that.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.