예제 #1
0
  public GameFile() {
    game = "";

    // load character names and descriptions
    characters = "";
    File characterFile = new File("/home/cory/Programming/treasure_hunt/data/characters.data");
    try {
      BufferedReader in = new BufferedReader(new FileReader(characterFile));
      for (String s = in.readLine(); s != null; s = in.readLine()) {
        characters += s + "\n";
      }
      characters.trim();
      in.close();
    } catch (IOException e) {
      System.out.println("File I/O error! Couldn't load character data file.");
      System.exit(1);
    }

    // load weapon names and descriptions
    weapons = "";
    File weaponFile = new File("/home/cory/Programming/treasure_hunt/data/weapons.data");
    try {
      BufferedReader in = new BufferedReader(new FileReader(weaponFile));
      for (String s = in.readLine(); s != null; s = in.readLine()) {
        weapons += s + "\n";
      }
      weapons.trim();
      in.close();
    } catch (IOException e) {
      System.out.println("File I/O error! Couldn't load weapon data file.");
      System.exit(1);
    }

    // load treasure names and desciptions
    treasures = "";
    File treasureFile = new File("/home/cory/Programming/treasure_hunt/data/treasures.data");
    try {
      BufferedReader in = new BufferedReader(new FileReader(treasureFile));
      for (String s = in.readLine(); s != null; s = in.readLine()) {
        treasures += s + "\n";
      }
      treasures.trim();
      in.close();
    } catch (IOException e) {
      System.out.println("File I/O error! Couldn't load treasure data file.");
      System.exit(1);
    }
  }
예제 #2
0
  public void getSavedLocations() {
    // System.out.println("inside getSavedLocations");				//CONSOLE * * * * * * * * * * * * *
    loc.clear(); // clear locations.  helps refresh the list when reprinting all the locations
    BufferedWriter f = null; // just in case file has not been created yet
    BufferedReader br = null;
    try {
      // attempt to open the locations file if it doesn't exist, create it
      f =
          new BufferedWriter(
              new FileWriter("savedLocations.txt", true)); // evaluated true if file does not exist
      br = new BufferedReader(new FileReader("savedLocations.txt"));

      String line; // each line is one index of the list
      loc.add("Saved Locations");
      // loop and read a line from the file as long as we don't get null
      while ((line = br.readLine()) != null)
        // add the read word to the wordList
        loc.add(line);
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      try {
        // attempt the close the file

        br.close(); // close bufferedwriter
      } catch (IOException ex) {
        ex.printStackTrace();
      }
    }
  }
예제 #3
0
파일: Installer.java 프로젝트: suever/CTP
  public boolean shutdown(int port, boolean ssl) {
    try {
      String protocol = "http" + (ssl ? "s" : "");
      URL url = new URL(protocol, "127.0.0.1", port, "shutdown");
      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setRequestMethod("GET");
      conn.setRequestProperty("servicemanager", "shutdown");
      conn.connect();

      StringBuffer sb = new StringBuffer();
      BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
      int n;
      char[] cbuf = new char[1024];
      while ((n = br.read(cbuf, 0, cbuf.length)) != -1) sb.append(cbuf, 0, n);
      br.close();
      String message = sb.toString().replace("<br>", "\n");
      if (message.contains("Goodbye")) {
        cp.appendln("Shutting down the server:");
        String[] lines = message.split("\n");
        for (String line : lines) {
          cp.append("...");
          cp.appendln(line);
        }
        return true;
      }
    } catch (Exception ex) {
    }
    cp.appendln("Unable to shutdown CTP");
    return false;
  }
예제 #4
0
파일: Main.java 프로젝트: joeytwiddle/code
 private Vector readlinesfromfile(String fname) { // trims lines and removes comments
   Vector v = new Vector();
   try {
     BufferedReader br = new BufferedReader(new FileReader(new File(fname)));
     while (br.ready()) {
       String tmp = br.readLine();
       // Strip comments
       while (tmp.indexOf("/*") >= 0) {
         int i = tmp.indexOf("/*");
         v.add(tmp.substring(0, i));
         String rest = tmp.substring(i + 2);
         while (tmp.indexOf("*/") == -1) {
           tmp = br.readLine();
         }
         tmp = tmp.substring(tmp.indexOf("*/") + 2);
       }
       if (tmp.indexOf("//") >= 0) tmp = tmp.substring(0, tmp.indexOf("//"));
       // Strip spaces
       tmp = tmp.trim();
       v.add(tmp);
       //        System.out.println("Read line "+tmp);
     }
     br.close();
   } catch (Exception e) {
     System.out.println("Exception " + e + " occured");
   }
   return v;
 }
예제 #5
0
  // Cleanup for disconnect
  private static void cleanUp() {
    try {
      if (hostServer != null) {
        hostServer.close();
        hostServer = null;
      }
    } catch (IOException e) {
      hostServer = null;
    }

    try {
      if (socket != null) {
        socket.close();
        socket = null;
      }
    } catch (IOException e) {
      socket = null;
    }

    try {
      if (in != null) {
        in.close();
        in = null;
      }
    } catch (IOException e) {
      in = null;
    }

    if (out != null) {
      out.close();
      out = null;
    }
  }
예제 #6
0
 @Override
 public void actionPerformed(ActionEvent e) {
   JFileChooser f = new JFileChooser();
   f.setFileFilter(new MyFileFilter()); // 設定檔案選擇器
   int choose = f.showOpenDialog(getContentPane()); // 顯示檔案選取
   if (choose == JFileChooser.OPEN_DIALOG) { // 有開啟檔案的話,開始讀檔
     BufferedReader br = null;
     try {
       File file = f.getSelectedFile();
       br = new BufferedReader(new FileReader(file));
       TextDocument ta = new TextDocument(file.getName(), file);
       ta.addKeyListener(new SystemTrackSave());
       ta.read(br, null);
       td.add(ta);
       td.setTitleAt(docCount++, file.getName());
     } catch (Exception exc) {
       exc.printStackTrace();
     } finally {
       try {
         br.close();
       } catch (Exception ecx) {
         ecx.printStackTrace();
       }
     }
   }
 }
예제 #7
0
  protected String gettitle(String strFreq) {
    StringBuffer sbufTitle = new StringBuffer().append("VnmrJ  ");
    String strPath = FileUtil.openPath(FileUtil.SYS_VNMR + "/vnmrrev");
    BufferedReader reader = WFileUtil.openReadFile(strPath);
    String strLine;
    String strtype = "";
    if (reader == null) return sbufTitle.toString();

    try {
      while ((strLine = reader.readLine()) != null) {
        strtype = strLine;
      }
      strtype = strtype.trim();
      if (strtype.equals("merc")) strtype = "Mercury";
      else if (strtype.equals("mercvx")) strtype = "Mercury-Vx";
      else if (strtype.equals("mercplus")) strtype = "MERCURY plus";
      else if (strtype.equals("inova")) strtype = "INOVA";
      String strHostName = m_strHostname;
      if (strHostName == null) strHostName = "";
      sbufTitle.append("    ").append(strHostName);
      sbufTitle.append("    ").append(strtype);
      sbufTitle.append(" - ").append(strFreq);
      reader.close();
    } catch (Exception e) {
      // e.printStackTrace();
      Messages.logError(e.toString());
    }

    return sbufTitle.toString();
  }
예제 #8
0
  /**
   * Get the Lincese text from a text file specified in the PropertyBox.
   *
   * @return String - License text.
   */
  public String getLicenseText() {
    StringBuffer textBuffer = new StringBuffer();
    try {
      String fileName = RuntimeProperties.GPL_EN_LICENSE_FILE_NAME;
      if (cbLang != null
          && cbLang.getSelectedItem() != null
          && cbLang.getSelectedItem().toString().equalsIgnoreCase("Eesti")) {
        fileName = RuntimeProperties.GPL_EE_LICENSE_FILE_NAME;
      }

      InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);

      if (is == null) return "";

      BufferedReader in = new BufferedReader(new InputStreamReader(is));
      String str;
      while ((str = in.readLine()) != null) {
        textBuffer.append(str);
        textBuffer.append("\n");
      }
      in.close();
    } catch (IOException e) {
      logger.error(null, e);
    }
    return textBuffer.toString();
  } // getLicenseText
예제 #9
0
    protected void writeAuditTrail(String strPath, String strUser, StringBuffer sbValues) {
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      String strLine;
      ArrayList aListData = WUtil.strToAList(sbValues.toString(), false, "\n");
      StringBuffer sbData = sbValues;
      String strPnl = (this instanceof DisplayTemplate) ? "Data Template " : "Data Dir ";
      if (reader == null) {
        Messages.postDebug("Error opening file " + strPath);
        return;
      }

      try {
        while ((strLine = reader.readLine()) != null) {
          // if the line in the file is not in the arraylist,
          // then that line has been deleted
          if (!aListData.contains(strLine))
            WUserUtil.writeAuditTrail(new Date(), strUser, "Deleted " + strPnl + strLine);

          // remove the lines that are also in the file or those which
          // have been deleted.
          aListData.remove(strLine);
        }

        // Traverse through the remaining new lines in the arraylist,
        // and write it to the audit trail
        for (int i = 0; i < aListData.size(); i++) {
          strLine = (String) aListData.get(i);
          WUserUtil.writeAuditTrail(new Date(), strUser, "Added " + strPnl + strLine);
        }
        reader.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
예제 #10
0
파일: Installer.java 프로젝트: suever/CTP
 private String getFileText(File file) throws Exception {
   BufferedReader br =
       new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
   StringWriter sw = new StringWriter();
   int n;
   char[] cbuf = new char[1024];
   while ((n = br.read(cbuf, 0, cbuf.length)) != -1) sw.write(cbuf, 0, n);
   br.close();
   return sw.toString();
 }
예제 #11
0
 private static void readCaptchaFile(String fileName) {
   try {
     BufferedReader reader = new BufferedReader(new FileReader(new File(fileName)));
     String line;
     while ((line = reader.readLine()) != null) captchaList.add(line);
     reader.close();
   } catch (Exception exception) {
     throw new RuntimeException(exception);
   }
 }
예제 #12
0
  public void open(File file) {
    try {
      BufferedReader in = new BufferedReader(new FileReader(file));
      game = "";

      for (String s = in.readLine(); s != null; s = in.readLine()) {
        game += s + "\n";
      }
      game.trim();
      in.close();
    } catch (IOException e) {
      System.out.println("File I/O error!");
    }
  }
예제 #13
0
  public Duder(String args[]) {

    getConnected(args);

    play();

    try {
      sin.close();
      sout.close();
      s.close();
    } catch (IOException e) {
      System.out.println(e);
    }
  }
예제 #14
0
 static {
   List<String> spamlist = new ArrayList<String>();
   try {
     BufferedReader reader = new BufferedReader(new FileReader(new File("spamlist.txt")));
     String line;
     while ((line = reader.readLine()) != null) {
       if (line.trim().isEmpty()) continue;
       spamlist.add(line);
     }
     reader.close();
   } catch (Exception exception) {
   }
   spamList = spamlist.toArray(new String[0]);
 }
예제 #15
0
    public void actionPerformed(ActionEvent ae) {

      if (ae.getActionCommand().equals("clear")) {
        scriptArea.setText("");
      } else if (ae.getActionCommand().equals("save")) {
        // fc.setCurrentDirectory(new File("/Users/jc/Documents/LOGO"));
        int bandera = fileChooser.showSaveDialog(myWindow);
        if (bandera == JFileChooser.APPROVE_OPTION) {
          String cadena1 = scriptArea.getText();
          String cadena2 = cadena1.replace("\r", "\n");
          System.out.println(cadena1);
          try {
            BufferedWriter script =
                new BufferedWriter(new FileWriter(fileChooser.getSelectedFile() + ".txt"));
            script.write(cadena2);
            script.close();
          } catch (Exception ex) {
            ex.printStackTrace();
          }
          File file = fileChooser.getSelectedFile();
          JOptionPane.showMessageDialog(myWindow, "File: " + file.getName() + " Saved.\n");
        }
        scriptArea.setCaretPosition(scriptArea.getDocument().getLength());
      } else if (ae.getActionCommand().equals("quit")) {
        myWindow.setVisible(false);
      } else if (ae.getActionCommand().equals("load")) {
        // String arreglo[] = new String[100];
        // int i = 0;
        // fc.setCurrentDirectory(new File("/Users/jc/Documents/LOGO"));
        int bandera = fileChooser.showOpenDialog(myWindow);
        if (bandera == JFileChooser.APPROVE_OPTION) {
          try {
            BufferedReader script =
                new BufferedReader(new FileReader(fileChooser.getSelectedFile()));
            scriptArea.read(script, null);
            script.close();
            scriptArea.requestFocus();
          } catch (Exception ex) {
            ex.printStackTrace();
          }
          File file = fileChooser.getSelectedFile();
          myWindow.setTitle(file.getName());
          JOptionPane.showMessageDialog(myWindow, file.getName() + ": File loaded.\n");
          scriptArea.setCaretPosition(scriptArea.getDocument().getLength());
        }
      } else if (ae.getActionCommand().equals("run")) {
        System.out.println("LEL");
      }
    }
예제 #16
0
  /** 利用IO流接受外部的文本文件 */
  private void receiveTxt() {

    InputStream txtPath = DeteDialog.class.getResourceAsStream("help.txt");
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(txtPath));
      String line;
      while ((line = in.readLine()) != null) {
        textArea.append(line + "\n");
      }

      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
예제 #17
0
파일: JChat.java 프로젝트: ThatoP/JChat
 @Override
 public void run() {
   // TODO Auto-generated method stub
   String inputLine;
   try {
     while ((inputLine = in.readLine()) != null) {
       inputLine = "\nYour peer says >> " + inputLine;
       chatField.append(inputLine);
     }
     out.close();
     in.close();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
  private void loadFile(File file) {
    cardList = new ArrayList<QuizCard>();
    try {
      BufferedReader reader = new BufferedReader(new FileReader(file));
      String line = null;
      while ((line = reader.readLine()) != null) {
        makeCard(line);
      }
      reader.close();
    } catch (Exception ex) {
      System.out.println("Couldn't read the Card file ");
      ex.printStackTrace();
    }

    showNextCard();
  }
예제 #19
0
  /** based on http://www.exampledepot.com/egs/java.net/Post.html */
  private void GetNewRobotUID() {
    try {
      // Send data
      URL url = new URL("http://marginallyclever.com/drawbot_getuid.php");
      URLConnection conn = url.openConnection();
      BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      robot_uid = Long.parseLong(rd.readLine());
      rd.close();
    } catch (Exception e) {
    }

    // did read go ok?
    if (robot_uid != 0) {
      SendLineToRobot("UID " + robot_uid);
    }
  }
 public String skaitytiNeregAutos(String fName) {
   if (fName.isEmpty()) return "nenurodytas failo vardas";
   try {
     BufferedReader fReader = new BufferedReader(new FileReader(new File(fName)));
     String dLine;
     while ((dLine = fReader.readLine()) != null) {
       neregAuto.add(new Automobilis(dLine));
     }
     fReader.close();
     return "OK - failas " + fName + " perskaitytas";
   } catch (FileNotFoundException e) {
     return ("Duomenų failas " + fName + " nerastas");
   } catch (IOException e) {
     return ("Failo " + fName + " skaitymo klaida");
   }
 }
예제 #21
0
  protected void setTrayPresent(String strPath) {
    String strzone = "zones";
    BufferedReader reader = WFileUtil.openReadFile(strPath);
    if (reader == null) return;

    String strLine;
    try {
      // if the zones are set to 0, then there is no tray present
      // set rackInfo(1,zones) 3 => tray 1 present
      // set rackInfo(2,zones) 0 => tray 2 not present
      while ((strLine = reader.readLine()) != null) {
        int index = strLine.indexOf(strzone);
        if (index < 0) continue;

        String strTray = strLine.substring(index - 2, index - 1);
        int nTray = 0;
        try {
          nTray = Integer.parseInt(strTray);
        } catch (Exception e) {
        }

        if (nTray <= 0) continue;

        int nZone = 0;
        try {
          strTray = strLine.substring(index + strzone.length() + 2, strLine.length());
          nZone = Integer.parseInt(strTray);
        } catch (Exception e) {
        }

        Color colorbg = Color.white;
        String strTooltip = TRAY;
        if (nZone <= 0) {
          colorbg = Color.black;
          strTooltip = NOTRAY;
        }
        VBox pnlVast = m_pnlVast[nTray - 1];
        pnlVast.setbackground(colorbg);
        pnlVast.setToolTipText(Util.getTooltipString(strTooltip));
      }
      reader.close();
    } catch (Exception e) {
      // e.printStackTrace();
      Messages.writeStackTrace(e);
    }
  }
예제 #22
0
 private static List<String> loadLoginProxies(String fileName) {
   List<String> proxies = new ArrayList<String>();
   try {
     BufferedReader reader = new BufferedReader(new FileReader(new File(fileName)));
     String line;
     while ((line = reader.readLine()) != null) {
       if (line.trim().isEmpty()) continue;
       String[] parts = line.split(" ")[0].trim().split(":");
       proxies.add(parts[0].trim() + ":" + Integer.parseInt(parts[1].trim()));
     }
     reader.close();
   } catch (Exception exception) {
     throw new RuntimeException(exception);
   }
   System.out.println("Loaded " + proxies.size() + " login proxies.");
   return proxies;
 }
예제 #23
0
 public void readFile() {
   try {
     String inputfile = "info.txt";
     BufferedReader in = new BufferedReader(new FileReader(inputfile));
     String line = in.readLine();
     while (line != null) {
       String newLine = line.toLowerCase();
       if (newLine.startsWith("starnum")) {
         String numStarsString = newLine.substring(7);
         starNum = Integer.parseInt(numStarsString.trim());
       }
       line = in.readLine();
     }
     in.close();
   } catch (IOException ioe) {
   }
 }
예제 #24
0
  public static void main(String[] args) throws Throwable {
    /*        for(String i:args)
        {
            System.out.println(i+" : "+benchmark(i));
        }
    */
    String chaine = "";
    String fichier = "test";
    Algorithme easy, medium;
    int nb = 0;
    int moy = 0;
    int moyEasy = 0;
    int moyMedium = 0;
    /*InputStream ips=new FileInputStream(fichier);
    InputStreamReader ipsr=new InputStreamReader(ips);
    BufferedReader br=new BufferedReader(ipsr);*/
    FileReader f = new FileReader(fichier);

    BufferedReader br = new BufferedReader(f);
    String ligne;
    while ((ligne = br.readLine()) != null) {
      // System.out.println(ligne+" : "+benchmark(ligne));
      // System.out.println(benchmark(ligne));
      chaine += ligne + "\n";
      nb++;
      easy = easy(ligne);
      medium = medium(ligne);

      moy += medium.taille() - easy.taille();
      moyEasy += easy.taille();
      moyMedium += medium.taille();
    }
    if (nb != 0) {

      float m = ((float) moy) / ((float) nb);
      float me = ((float) moyEasy) / ((float) nb);
      float mm = ((float) moyMedium) / ((float) nb);

      System.out.println(
          "moyenne : " + m + "/" + me + " avec en moyenne " + mm + " sur " + nb + " mélanges");
      // System.out.println(moy+" "+moyEasy+" "+moyMedium+" "+nb);

    }

    br.close();
  }
예제 #25
0
	FileHash(File f) {
		hash=new long[(int)f.length()];
		length=f.length();
		int i=0;
		int h=0;
    try {
      BufferedReader br=new BufferedReader(new FileReader(f));
      while (br.ready()) {
				int c=br.read();
				h=h+c;
				hash[i]=h;
      }
      br.close();
    } catch (Exception e) {
      System.out.println("What should I do with exception "+e+" ?");
    }
		System.out.println(""+h);
  }
예제 #26
0
    public void run() {
      try {
        BufferedReader br =
            new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
        if (outputFile != null) {
          bw =
              new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), charset));
        }
        String line;
        while ((line = br.readLine()) != null) {
          filePosition += line.length() + 2;
          line = line.trim();
          if (!line.startsWith("#")) {
            String[] sides = split(line);
            if ((sides != null) && !sides[0].equals("key")) {

              if (searchPHI) {
                // Search the decrypted PHI for the searchText
                sides[0] = decrypt(sides[0]);
                if (sides[0].indexOf(searchText) != -1) {
                  output(sides[0] + " = " + sides[1] + "\n");
                }
              } else {
                // Search the trial ID for the searchText
                if (sides[1].indexOf(searchText) != -1) {
                  sides[0] = decrypt(sides[0]);
                  output(sides[0] + " = " + sides[1] + "\n");
                }
              }
            }
          }
        }
        br.close();
        if (bw != null) {
          bw.flush();
          bw.close();
        }
      } catch (Exception e) {
        append("\n\n" + e.getClass().getName() + ": " + e.getMessage() + "\n");
      }
      append("\nDone.\n");
      setMessage("Ready...");
    }
예제 #27
0
  /** Constructor for allocating memory and simple initializing. */
  public GameBoard() {
    dealerPanel = new JPanel();
    playerPanel = new JPanel();
    controlPanel = new JPanel();
    money = new JLabel();
    record = new JLabel();
    inputImage = new JLabel(new ImageIcon("res/INPUT.gif"));
    moneyLabel = new JLabel(new ImageIcon("res/MONEY.gif"));
    betLabel = new JLabel(new ImageIcon("res/MAKE_YOUR_BET.gif"));
    recordLabel = new JLabel(new ImageIcon("res/BEST_SCORE.gif"));
    betButton = new JButton(new ImageIcon("res/BET.gif"));
    resultButton = new JButton(new ImageIcon("res/RESULT.gif"));
    betInput = new JTextField();

    try {
      recordReader = new BufferedReader(new FileReader("res/record"));
      bestScore = Integer.parseInt(recordReader.readLine());
      recordReader.close();
    } catch (Exception e) {
      e.printStackTrace();
    }

    inputImage.setLayout(new BorderLayout());
    controlPanel.setLayout(new FlowLayout());

    betInput.setHorizontalAlignment(JTextField.CENTER);
    betButton.setBorder(BorderFactory.createEmptyBorder());
    betButton.setContentAreaFilled(false);
    resultButton.setBorder(BorderFactory.createEmptyBorder());
    resultButton.setContentAreaFilled(false);
    resultButton.setEnabled(false);
    betButton.addMouseListener(new BetListener());
    resultButton.addMouseListener(new ResultListener());
    betInput.setOpaque(false);
    betInput.setBorder(BorderFactory.createEmptyBorder());
    money.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    record.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    setOpaque(false);

    initGame();
    initRound();
  }
예제 #28
0
  public void setGoal(File file) throws FileNotFoundException, IOException {
    FileInputStream fstream = new FileInputStream(file);
    // Get the object of DataInputStream
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    // Read File Line By Line
    strLine = br.readLine();
    input_count = Integer.valueOf(br.readLine());
    results = new String[input_count];
    tapes = new String[input_count];

    for (int i = 0; i < input_count; i++) {
      results[i] = br.readLine();
      tapes[i] = br.readLine();
    }
    jLabel1.setText(strLine);
    jLabel1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
    br.close();
  }
예제 #29
0
 public void setSolution(File file) throws FileNotFoundException, IOException {
   FileInputStream fstream = new FileInputStream(file);
   // Get the object of DataInputStream
   DataInputStream in = new DataInputStream(fstream);
   BufferedReader br = new BufferedReader(new InputStreamReader(in));
   String strLine;
   strLine = br.readLine();
   sol_rows = Integer.valueOf(strLine);
   strLine = br.readLine();
   sol_columns = Integer.valueOf(strLine);
   sol_data = new char[sol_rows][sol_columns];
   // Read File Line By Line
   for (int i = 0; i < sol_rows; i++) {
     strLine = br.readLine();
     for (int j = 0; j < 2 * sol_columns; j += 2) {
       sol_data[i][(j / 2)] = strLine.charAt(j);
     }
   }
   br.close();
 }
  // ----------------------------------------------------------------------------------------
  public Gui21fileIOClass() throws IOException // constructor
      {
    super("Simple File I/O");
    FileReader diskfile = new FileReader("gui21dataIn.txt");
    BufferedReader stufile = new BufferedReader(diskfile);

    txtAreaLeft = new JTextArea();
    txtAreaRight = new JTextArea();
    JPanel txtPnl = new JPanel();

    JButton copyBtn = new JButton("Copy");
    JButton saveBtn = new JButton("Save");
    JPanel btnPnl = new JPanel();

    String rec;
    String names = "";

    setLayout(new BorderLayout(0, 0));

    txtPnl.setLayout(new GridLayout(1, 2));
    txtPnl.add(txtAreaLeft);
    txtPnl.add(txtAreaRight);
    add(txtPnl, BorderLayout.CENTER);

    btnPnl.setLayout(new GridLayout(1, 2));
    btnPnl.add(copyBtn);
    btnPnl.add(saveBtn);
    add(btnPnl, BorderLayout.SOUTH);

    while ((rec = stufile.readLine()) != null) names = names + (rec + "\n");

    txtAreaLeft.setText(names);

    CopyHandler copyHdlr = new CopyHandler(); // instantiate handlers
    SaveHandler saveHdlr = new SaveHandler();

    copyBtn.addActionListener(copyHdlr); // register handlers
    saveBtn.addActionListener(saveHdlr);

    stufile.close();
  } // end constructor