nolife33033 0 Posted August 1, 2021 I am working with JcomboBox's for my GUI to select Locations and Type of Ore. I can not figure out how to set it up so that If Lumbridge is selected it only shows the ore's that are available at lumbridge mine to select from. P.s I use JForm Designer
Hosfad 155 Posted August 2, 2021 Hello @nolife33033 , you wanna do something like this LocationBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { switch (getFishArea()) { case "Lumbridge swamp": FishType.removeAllItems(); FishType.addItem("Net/Bait (level 1,Small fishing net)"); FishType.addItem("Net/Bait (level 5,Fishing rod,Fishing bait)"); break; case "Draynor village": FishType.removeAllItems(); FishType.addItem("Net/Bait (level 1,Small fishing net)"); FishType.addItem("Net/Bait (level 5,Fishing rod,Fishing bait)"); break; } });
Hosfad 155 Posted August 2, 2021 10 minutes ago, Hosfad said: Hello @nolife33033 , you wanna do something like this LocationBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { switch (getFishArea()) { case "Lumbridge swamp": FishType.removeAllItems(); FishType.addItem("Net/Bait (level 1,Small fishing net)"); FishType.addItem("Net/Bait (level 5,Fishing rod,Fishing bait)"); break; case "Draynor village": FishType.removeAllItems(); FishType.addItem("Net/Bait (level 1,Small fishing net)"); FishType.addItem("Net/Bait (level 5,Fishing rod,Fishing bait)"); break; } }); The get fish area method is just LocationBox.getSelectedItem.toString()
Recommended Posts
Archived
This topic is now archived and is closed to further replies.