importing a text file
<p>any way easier to do this??</p>

<p>i'm trying to import a file which is four lines:</p>

<pre>
name
phone
mobile
address
</pre>

<p>I'm using:</p>

<pre><code>public void importContacts() {
    try {
        BufferedReader infoReader = new BufferedReader(new FileReader(
                "../files/example.txt"));
        int i = 0;
        String loadContacts;

        while ((loadContacts = infoReader.readLine()) != null) {
            temp.add(loadContacts);
            i++;
        }

        int a = 0;
        int b = 0;

        for (a = 0, b = 0; a &lt; temp.size(); a++, b++) {
            if (b == 4) {
                b = 0;
            }

            if (b == 0) {
                Name.add(temp.get(a));
            }

            if (b == 1) {
                Phone.add(temp.get(a));
            }

            if (b == 2) {
                Mobile.add(temp.get(a));
            }

            if (b == 3) {
                Address.add(temp.get(a));
            }
        }
    }

    catch (IOException ioe) {
        JOptionPane.showMessageDialog(null, ioe.getMessage());

    }

    txtName.setText(Name.get(index));
    txtPhone.setText(Phone.get(index));
    txtMobile.setText(Mobile.get(index));
    txtAddress.setText(Address.get(index));

}
</code></pre>

<p>is their an easier way? looks long winded!</p>
