You could use an enum to make it a little cleaner
public enum ThievingMethods {
STALLS("Stalls", "Cake stall", "Silk stall", "Fruit stall"),
PICKPOCKET("Pickpocketing", "Man", "Knight of Ardougne", "Elf"),
CHESTS("Chests", "Ardougne chest", "Some other chest");
private final string description;
private final String[] availableMethods;
private ThievingMethods(String description, String... availableMethods) {
this.description = description;
this.availableMethods = availableMethods;
}
public String[] getThievingMethods() {
return availableMethods;
}
@override
public String toString() {
return description;
}
}
and then populate the combobox with your enum values + set an actionListener
comboBox.setModel(new DefaultComboBoxModel<>(ThievingMethods.values()));
comboBox.addActionListener(e -> comboBox_1.setModel(new DefaultComboBoxModel<>(((ThievingMethods)comboBox.getSelectedItem()).getThievingMethods())));
By default if you populate a combobox with Objects, it will display the toString value of the objects in the drop-down.