I\'m trying to implement a feature inside the current program that I\'m writing and I wanna learn how to scroll down to specific text inside a JTextArea. For example, lets s
Add on to the comment by MadProgrammer:
scrollRectToVisible(viewRect)
is deprecated as of Java SE9, and it has been replaced by scrollRectToVisible2D(viewRect)
The proper way to get the text to display without using deprecated functions would be:
java.awt.geom.Rectangle2D view = area.modelToView2D(pos); // View where pos is visible
area.scrollRectToVisible(view.getBounds()); // Scroll to the rectangle provided by view
area.setCaretPosition(pos); // Sets carat position to pos