0

I have two combo boxes containing names of teams read from a file, the idea is that one is the home team, the other the away team. The two combos are reading from the same file, however, how could I remove the team from the other combo if it was selected in the first one? I hope my question makes some sense. I just need some guidance on how to tackle this.

 BufferedReader input = null;
    try 
    {
        input = new BufferedReader(new FileReader("CSLteams.dat"));
    } 
    catch (FileNotFoundException e1) 
    {
        e1.printStackTrace();
    }
    ArrayList<String> strings = new ArrayList<String>();
    try 
    {
      String line = null;
      while (( line = input.readLine()) != null)
      {
        strings.add(line);
      }
    }

    catch (FileNotFoundException e) 
    {
        System.err.println("Error, file " + "CSLteams.dat" + " didn't exist.");
    } 
    catch (IOException e) 
    {
        e.printStackTrace();
    }
    finally 
    {
        try 
        {
            input.close();
        } 
        catch (IOException e) 
        {
            e.printStackTrace();
        }
    }

    String[] teamArray = strings.toArray(new String[]{});

So the teamArray is the list that appears in my combo boxes.

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
PrOjEkTeD
  • 161
  • 1
  • 2
  • 11
  • You might look at the approach shown [here](http://stackoverflow.com/q/3191837/230513) – trashgod Apr 04 '14 at 02:14
  • I appreciate your answer. The problem however is that I can only read from one file, I can not have another file, and I can not hard code the list of the teams. The file I read the teams from has to be independent from the application, or the other way around. – PrOjEkTeD Apr 04 '14 at 02:18
  • 1
    The point of the example is to alter the _models_; the views will respond accordingly. – trashgod Apr 04 '14 at 02:20

0 Answers0