private void loadFileNumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadFileNumActionPerformed
        try {
            String newLine = "\\n";
            String sourceContents;
            /*/Code to read from file
            File inputFile = new File(inputFileName);
            FileInputStream in = new FileInputStream(inputFile);
            byte bt[] = new byte[(int)inputFile.length()];
            in.read(bt);
            String sourceContents = new String(bt);
            in.close();*/
            sourceContents = jTextPaneSource.getText();
            if(sourceContents.isEmpty()){
                JOptionPane.showMessageDialog(rootPane, "Please Load the File with out Line Numbers First");
                return;
            }
            jTextPaneSource.setText("");
            DefaultStyledDocument sourceDoc = (DefaultStyledDocument) jTextPaneSource.getDocument();

            //line numbers
            sourceContents = "1 " + sourceContents;
            StringBuffer sourceBuffer = new StringBuffer(sourceContents);

            //find offsets
            Pattern pCPName = Pattern.compile(newLine, Pattern.MULTILINE);
            Matcher cpMatcher = pCPName.matcher(sourceBuffer);
            ArrayList offEnd = new ArrayList();
            int count = 0;
            while (cpMatcher.find()) {
                offEnd.add(cpMatcher.end());
            }


            //Insert line num
            int endLineVal = offEnd.size() - 1;
            count = offEnd.size() + 1;

            for (int i = endLineVal; i >= 0; --i) {
                String insertString = count + " ";
                int endOff = Integer.parseInt(offEnd.get(i).toString());
                sourceBuffer.insert(endOff, insertString);
                --count;
            }

            String sourceContentsLines = new String(sourceBuffer);
            //Clear text area
            jTextPaneSource.setText("");
            //Display text read from file
            sourceDoc.insertString(0, sourceContentsLines, null);
            //jTextPaneSource.setText(sourceContents);
            jTextPaneSource.setCaretPosition(0);

        } catch (BadLocationException ex) {
            jTextPaneSource.setText("");
            JOptionPane.showMessageDialog(jScrollPaneText, "Error: " + ex, "Applet Error", JOptionPane.ERROR_MESSAGE);
        }
 
    }//GEN-LAST:event_loadFileNumActionPerformed