Looking for some help. I have a list of planes (strings) in a combo box to be selected by the user and when a particular plane is selected I want to be able reference it. I am mostly self-taught so bear with me.
Link to download full code
String[] planeTitles = new String[] {"Focke-Wulf Fw 190", "Messerschmitt Bf 109","Messerschmitt Me 262", "Supermarine MKs 24 Spitfire",
"Yakovlev Yak-3", "Vought F4U Corsair", "Lockheed P-38 Lightning", "North American P-51 Mustang", "Mitsubishi A6M Zero"};
JComboBox<String> planeList = new JComboBox<>(planeTitles);
// add to the parent container (e.g. a JFrame):
add(planeList);
// get the selected item:
planeList.addActionListener (
new ActionListener () {
public void actionPerformed(ActionEvent e) {
String selectedPlane = (String) planeList.getSelectedItem();
System.out.println("You seleted the: " + selectedPlane);
textPane.setText("You seleted the: " + selectedPlane);
}
});
The planes later need to compare to user generated data. Basically my question is how would you create an object for each plane and assign it to my current list of planes? I know it is probably a bit much to ask...