I have to print the text from a file for a piece of code that is called a JTextArea text field. Unfortunately the method I'm using goes line by line (not ideal) and so I have to attach each line with a \ n it's now Okay, but a new line is finally made. I have the code as follows: How about:
Open the class menu Open ActionListener {Public Zero Functionality (ActionEvent e) {{file filePath = new file ("c: \ Test .text "); FileInputStream file = new FileInputStream (filePath); Buffed reader br = new buffed reader (new inputstream reader (file)); String display text; While ((displayText = br.readline ())! = Tap) {textArea.append (displayText + "\ n"); }} Hold (FileNotFoundException e1) {e1.printStackTrace (); } Hold (IOException e1) {e1.printStackTrace (); Can anyone help me get rid of that last line?
text.substring (0, Text.lastIndexOf ('\ n'));
Comments
Post a Comment