This is what I currently have but its not not showing the results in two textareas.. Right now all it shows is one textarea with Odd numbers only. I'm not sure why the even numbers wont show. Any help is appreciated Thanks!
static TextFileInput inFile;
static String inFileName = "lab12.txt";
static JFrame myFrame;
static Container cPane;
static TextArea even, odd;
public static void main(String[] args) {
initialize();
readNumbersFromFile(inFileName);
}
public static void initialize() {
inFile = new TextFileInput(inFileName);
even = new TextArea();
odd = new TextArea();
myFrame=new JFrame();
myFrame.setSize(400,400);
myFrame.setLocation(200, 200);
myFrame.setTitle("test");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setVisible(true);
}
public static void readNumbersFromFile(String fileName){
String[] num = new String[20];
String line;
line = inFile.readLine();
for(int i = 0; i < inFile.getLineCount(); i++){
num[i] = line;
line = inFile.readLine();
}
cPane = myFrame.getContentPane();
cPane.add(even);
cPane.add(odd);
for(int i = 0; i < inFile.getLineCount(); i++){
if(Integer.parseInt(num[i]) % 2 == 0)
even.append(num[i] + "\n");
else
odd.append(num[i] + "\n");
}//for
myFrame.setVisible(true);
}//readSSNsFromFile