I understand how to do the basics of this. As in if I had the following in a text file: (each number represents a new line, wouldn't actually be in the file)
- Item1
- Item2
- Item3
and so on, using the example from this question/answer, I could populate a JComboBox
list fine. It adds the line's string as a combobox
option.
My issue is that I'm not using a text file that looks like the one above, instead it looks like this:
- Item1 6.00
- Item2 8.00
- Item3 9.00
the numbers being prices I'd have to convert to a double later on. But from that text file the price would be included in the JComboBox
, something I don't want to happen. Is there a way to specify the first String of each line? I won't have more than 2 strings per line in the file.