public static String[] readFromFile(JComponent parent, int numLines) {
        int numberOfLines = numLines;
        JFileChooser filechooser = new JFileChooser("Import Data From");
        filechooser.addChoosableFileFilter(new CSVFilter());
        int returnVal = filechooser.showOpenDialog(parent.getTopLevelAncestor());

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = filechooser.getSelectedFile();
            List<String> data = new ArrayList<String>();
            BufferedReader input = null;
            String line = null;
            if (file != null) {
                try {
                    input = new BufferedReader(new FileReader(file));
                    while ((line = input.readLine()) != null && numberOfLines > 0) {
                        numberOfLines--;
                        data.add(line);
                    }
                } catch (FileNotFoundException ex) {
                    throw new RuntimeException(ex);
                } catch (IOException ex) {
                    throw new RuntimeException(ex);
                } finally {
                    try {
                        if (input != null) {
                            input.close();
                        }
                    } catch (IOException ex) {
                        throw new RuntimeException(ex);
                    }
                }
                return data.toArray(new String[data.size()]);
            }
        }
        return null;
    }