title: JFrame Printing out not as expected. if loop trouble
body: <p>Sorry for the long code, didn't want to leave anything out.<br/>
  Little explanation, I'm just trying to do a way where the user inputs a date to check there history between the two dates <br/> now i have it working to an extent, it reads of a text document, which for each transactions has 8 lines that need to be printed if the date is between the dates<br/>
  the Example document is structured as below: </p>
  
  <pre><code>######## START OF TRANSACTION ########
  Name: name
  DATE: 14/05/2015
  Ammount: 100 
  Address: address
  Card Number: 123312
  ExpiryDate: 123312 
  ######## END OF TRANSACTION ########
  ######## START OF TRANSACTION ########
  Name: name 
  DATE: 19/05/2015 
  Ammount: 100 
  Address: address 
  Card Number: 123312
  ExpiryDate: 123312 
  ######## END OF TRANSACTION ########
  </code></pre>
  
  <p>if i input the date 15-05-2015 to 16-05-2015 <br>
  i get:</p>
  
  <pre><code>######## START OF TRANSACTION ########
  Name: name
  DATE: 14/05/2015
  Ammount: 100
  Address: address
  Card Number: 123312
  ExpiryDate: 123312
  null######## END OF TRANSACTION ########
  ######## START OF TRANSACTION ########
  Name: name
  DATE: 19/05/2015
  Ammount: 105
  Address: address
  Card Number: 123312
  null
  </code></pre>
  
  <p>1: what is with the NULL values guessing my loop<br>
   2: why does it print the 19. even if i have the 16th in their it still prints the 19th....please help, I've been on this for awhile</p>
  
  <pre><code> import javax.swing.*;
   import java.awt.Dialog.ModalityType;
   import java.awt.event.*;
   import java.awt.*;
   import java.io.BufferedReader;
   import java.io.File;
   import java.io.FileReader;
   import java.io.IOException;
   import java.text.ParseException;
   import java.text.SimpleDateFormat;
   import java.util.*;
  
      public class TopUpHistoryScreen extends JDialog {
      private JPanel mainPanel;
      private JTextArea historyScreen;
  
      public TopUpHistoryScreen()
      {
      setPanels();
  
      setModalityType(ModalityType.APPLICATION_MODAL);
      setSize(400, 450);
      setVisible(true);
  }
  public String Reader() {
      try {
  
          ArrayList&lt;String&gt; Trains = new ArrayList&lt;String&gt;();
          int count = 0;
          String testing = "";
          File file = new File("TopUp.txt");
          FileReader fileReader = new FileReader(file);
          BufferedReader bufferedReader = new BufferedReader(fileReader);
          StringBuffer stringBuffer = new StringBuffer();
          String line;
          while ((line = bufferedReader.readLine()) != null) 
          {
              stringBuffer.append(line);
              count += count;
              Trains.add(line + "\n");
              stringBuffer.append("\n");
              testing += line + "\n";
              //field.setText(line);
  
  
          }
          fileReader.close();
          return testing;
      } catch (IOException e) {
          e.printStackTrace();
      }
      return null;
  }
  public String checkDates(String startDate, String endDate) {
      try {
  
          ArrayList&lt;String&gt; Lines = new ArrayList&lt;String&gt;();
          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
          int count = 0;
          int check = 0;
          String[] lineArray = new String[8];
          String DateSelected = "";
          String testing="";
          File file = new File("TopUp.txt");
          FileReader fileReader = new FileReader(file);
          BufferedReader bufferedReader = new BufferedReader(fileReader);
          StringBuffer stringBuffer = new StringBuffer();
          String line;
          while ((line = bufferedReader.readLine()) != null) 
          {
              lineArray[count] = line+"\n";
  
              if (count &lt; 8){
                  count ++;
              }
  
              if (count == 7){
                  if(check == 1){
                  testing += lineArray[0];
                  testing += lineArray[1];
                  testing += lineArray[2];
                  testing += lineArray[3];
                  testing += lineArray[4];
                  testing += lineArray[5];
                  testing += lineArray[6];
                  testing += lineArray[7];
                  check = 0;
                  }
              }
              if (count == 7){
                  count = 0;
                  check = 0;
                  lineArray = new String[8];
              }
  
  
              if (line.contains("DATE")){
                  try {
              DateSelected = line.replace("DATE: ", "");
              Date MainDate = sdf.parse(DateSelected);
              Date SDate = sdf.parse(startDate);
              Date EDate = sdf.parse(endDate);
              if(MainDate.compareTo(SDate)&gt;=0 || MainDate.compareTo(EDate)&lt;=0 ){ 
  
  //is after Sdate and before eDate
                      check = 1;
                  }
  //              if(MainDate.compareTo(SDate)&lt;0){ //is Before SDate
  //                  
  //              }
  //              if(MainDate.compareTo(SDate)==0){ //is equal to mainDate
  //                  
  //              }
              } catch (ParseException e) {
                  //e.printStackTrace();
              }
  
              }
              stringBuffer.append(line);
  
              Lines.add(line + "\n");
              stringBuffer.append("\n");
  
  
  
          }
          fileReader.close();
          return testing;
      } catch (IOException e) {
          e.printStackTrace();
      }
      return null;
  }
  
  public void setPanels()
  {
      mainPanel = new JPanel(new GridLayout(0, 2));
      JPanel containerPanel = new JPanel(new GridLayout(0, 1));
      JPanel lowerPanel = new JPanel(new FlowLayout());
      //JButton apply = new JButton("Select data area");
      JButton exit = new JButton("Okay!");
      exit.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
              dispose();
          }
      });
      JButton checkDate = new JButton("check dates");
  
  
      JLabel START = new JLabel("START DATE!");
      JLabel startDay = new JLabel("Day:");
      JTextField sDay = new JTextField();
  
      JLabel startMonth = new JLabel("Month:");
      JTextField sMonth = new JTextField();
  
      JLabel startYear = new JLabel("Year:");
      JTextField sYear = new JTextField("2015");
  
      JLabel END = new JLabel("END DATE!");
  
      JLabel endDay = new JLabel("Day:");
      JTextField eDay = new JTextField();
  
      JLabel endMonth = new JLabel("Month:");
      JTextField eMonth = new JTextField();
  
      JLabel endYear = new JLabel("Year:");
      JTextField eYear = new JTextField("2015");
  
      //JTextField Data = new JTextField();
      //JTextField touchOnTimeFieldminute = new JTextField();
  
      historyScreen = new JTextArea(10,20);
      JScrollPane scrolll = new JScrollPane(historyScreen);
  
      //mainPanel.add(SelectData);
       //mainPanel.add(SelectData);
      // mainPanel.add(new JLabel());
      mainPanel.add(new JLabel());
          mainPanel.add(START);
          mainPanel.add(startDay);
          mainPanel.add(sDay);
          mainPanel.add(startMonth);
          mainPanel.add(sMonth);
          mainPanel.add(startYear);
          mainPanel.add(sYear);
  
          mainPanel.add(new JLabel());
          mainPanel.add(END);
          mainPanel.add(endDay);
          mainPanel.add(eDay);
          mainPanel.add(endMonth);
          mainPanel.add(eMonth);
          mainPanel.add(endYear);
          mainPanel.add(eYear);
          mainPanel.add(new JLabel());
          mainPanel.add(checkDate);
      lowerPanel.add(scrolll);
      lowerPanel.add(exit);
      containerPanel.add(mainPanel);
      containerPanel.add(lowerPanel);
  
      add(containerPanel);
      checkDate.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
  
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
  
              String startday = sDay.getText();
              String startmonth = sMonth.getText();
              String startyear = sYear.getText();
  
              String endday = eDay.getText();
              String endmonth = eMonth.getText();
              String endyear = eYear.getText();
  
              String startDate = (startday+"/"+startmonth+"/"+startyear);
              String endDate = (endday+"/"+endmonth+"/"+endyear);
  
              String AnswerDates = checkDates(startDate,endDate);
  
              historyScreen.setText(AnswerDates);
          }
      });
  }
  
  }
  </code></pre>