How to change highlighting color in Java Swing TextArea? And also, change the beginning of text corresponding to the highlighting location

前端 未结 4 1596
青春惊慌失措
青春惊慌失措 2020-11-27 07:22

Problem 1: BY using defaulthighlighter, I can make the focused lines change to blue. Now I want to change it to other colors. Do anyone know how to change this param

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 08:27

    To solve 2) Use modelToView to get point of the first selected row. Then use scrollRectToVisible using the Point (NOTE: height of the rectangle must be your viewport height).

提交回复
热议问题