String array from file to ComboBox
I have a file: myFile.txt
In that file is in every line: name + '\t' + numberOfYears.
I want to get String array of names and put that names to be ComboBox items.
I'm thinking like that:
1. make class ReadFromFile
2. in that class write a function getNames which opens a file, read line by line
and get from each line name and put it in string array. This function return that string array.
3. make class MyPanel extends JPanel
4. in MyPanel create object ReadFromFile and call function getNames.
5. use return value from this function to populate items in ComboBox.
please tell me your thinking, or share some ideas with me.
Please give me advice, or tell me better way of thinking and planing, or tell me is something wrong with my planning.