I am populating jComboBox1
from data.txt file. I am using this code to populate jComboBox1
.
The structure of text file as follows:
AAA 123456 BB 22 Some text
AAA 234567 CC 23 Some text
AAA 345678 DD 24 Some text
The goal that I want to achieve is display in jComboBox1
not all data, just certain column of data.
I found that substring
can be appropriate choice.
For example as shown in below code, in jComboBox1
I want to show data with position substring(12,17) + substring(58,97)
.
String data = strLine.substring(12,17);
String data2 = strLine.substring(58,97);
System.out.println(data + " " + data2);
But unfortunately I don't know how to achieve this goal.
Any help will be appreciated.