java print in textarea text file in reverse order

I'm using this code, it runs well but i need to add "\n" to each line

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

filename = "Reverse.txt";

file = new File(filename);

try (final Stream lines = Files.lines(Paths.get(filename))) {

lines.collect(Collectors.toCollection(LinkedList::new))

.descendingIterator()

.forEachRemaining(jTextArea1::append); // <<<<<<< need "\n"

}

catch (IOException ex) {

Logger.getLogger(TextAreaReverseReadFrame.class.getName()).log(Level.SEVERE, null, ex);

}

}...

Read More »

By: StackOverFlow - Friday, 9 November

Related Posts