so heres my code
import java.awt.*;
import java.text.*;
import java.util.*;
import java.util.List; // Explicit import required
import javax.swing.*;
public class Sort {
public static void main(String args[]) {
Runnable runner = new Runnable() {
public void run() {
String words[] = {"Sean", "Beth", "Ryan",
"Bree", "Jim", "Bob"};
List list = Arrays.asList(words);
JFrame frame = new JFrame("Sorting");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
Box box = Box.createVerticalBox();
frame.setContentPane(box);
JLabel label = new JLabel("Name List:");
box.add(label);
JTextArea textArea = new JTextArea( list.toString());
box.add(textArea);
Collections.sort(list);
label = new JLabel("Sorted Name List:");
box.add(label);
textArea = new JTextArea(list.toString ());
box.add(textArea);
frame.setSize(400, 200);
frame.setVisible(true);
}
};
EventQueue.invokeLater (runner);
}
}
Now instead of having the names entered in such as in this line of code
String words[] = {"Sean", "Beth", "Ryan",
"Bree", "Jim", "Bob"};
I want the names entered using a text file created in notepad, I know the file needs to be read into an array and all that Im just not sure how to replace the code e.g. where it goes in the code I already have