title: Can I use BufferedReader and create an array inside actionListener class?
body: <p>I've created an actionListener class. in the actionPerformed method, i would like run a code. This code involves importing data from multiple text files, and store them in a 2D array. Then it will print out a list of quotes in the frame. Then it will print out the 5 analysis and let the user choose which one. However, i am currently stuck with the IOException. Plus, some code states gives an error "unreachable code." What does that means? Below is the code for my actionListener class  </p>
  
  <pre><code>import java.awt.event.*;
  import java.io.*;
  import java.util.*;
  
  public class CrucibleButtonListener implements ActionListener 
  {
    private Swing g;
  
  public CrucibleButtonListener (Swing g)
  {
     this.g = g;
  }
  
  public void actionPerformed(ActionEvent e)
  {
     this.g.updateTextField(getQuotes());
  }
  
  private String getQuotes() throws IOException
  {
     BufferedReader inputQuote;
     BufferedReader inputTheme;
     BufferedReader inputCharacterAnalysis;
     BufferedReader inputSignificance;
     BufferedReader inputPlotEnhancement;
     BufferedReader inputSpeaker;
  
     Scanner in = new Scanner (System.in);
     int howMany=0;
     int quoteSelection;
     int analysisSelection;
  
     // Count how many lines in the text file
     FileReader fr = new FileReader ("CrucibleQuotations.txt");
     LineNumberReader ln = new LineNumberReader (fr);
     while (ln.readLine() != null)
     {
       howMany++;
     }
  
    //import information from the text file 
    inputQuote = new BufferedReader (new FileReader ("CrucibleQuotations.txt"));
    inputTheme = new BufferedReader (new FileReader("CrucibleTheme.txt"));
    inputCharacterAnalysis = new BufferedReader (new FileReader("CrucibleCharacterAnalysis.txt"));
    inputSignificance = new BufferedReader (new FileReader("CrucibleSignificance.txt"));
    inputPlotEnhancement = new BufferedReader (new FileReader("CruciblePlotEnhancement.txt"));
    inputSpeaker = new BufferedReader (new FileReader("CrucibleSpeaker.txt"));
  
  //Create array based on how many quotes available in the text file
  String [][] quotes = new String [howMany][6];
  
  //Store quote information in the array and display the list of quotations
  for (int i=0; i&lt;howMany; i++)
  {
    quotes [i][0] = inputQuote.readLine();
    return (i+1 + ") " + quotes [i][0]);
    quotes [i][1] = inputTheme.readLine();
    quotes [i][2] = inputCharacterAnalysis.readLine();
    quotes [i][3] = inputSignificance.readLine();
    quotes [i][4] = inputPlotEnhancement.readLine();
    quotes [i][5] = inputSpeaker.readLine();
  }
  
  //Ask user to choose the quote they want to analyze
  return ("Choose a quotation by inputting the number: ");    
  quoteSelection = in.nextInt ();
  
  if (quoteSelection!=0)
  {
    //Show user selections to analyze
    return ("1. Theme");
    return ("2. Character Analysis");
    return ("3. Significance");
    return ("4. Plot Enhancement");
    return ("5. Speaker");
    analysisSelection = in.nextInt ();
  
    //Display the analysis
    if (analysisSelection &lt;= 5 || analysisSelection &gt; 0)
    {
      return (quotes [quoteSelection-1][analysisSelection]);
    }
  }
  }
  }
  </code></pre>
  
  <p>Here is the swing class. It only contains a button, which i can't seem to make it work.</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.BorderLayout;
  import java.awt.GridLayout;
  import java.util.*;
  
  public class Swing 
  {  
    private JLabel label;
    public Swing()
    {    
      JFrame frame = new JFrame ("FRAME SAMPLE");
      frame.setSize(500, 500);
      frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
  
      JButton cButton = new JButton("The Crucible");//The JButton name.
      frame.add(cButton);//Add the button to the JFrame.
      cButton.addActionListener(new CrucibleButtonListener(this));
    }
  }
  </code></pre>
  
  <p>Main Class:</p>
  
  <pre><code>public class Main
  {
    public static void main (String [] args) 
    {
      new Swing();
    }
  }
  </code></pre>