Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scroll bars for multiple JTextPanes

This question is very similar to previously asked, but unfortunately, previous articles do not help much to solve a problem described below.

I would like to create a layout with three text areas that holds source code, code lines and some help information. And only one text area has a scroll bar. It's required to sync text areas in terms of text lines (wrapped text should not affect code lines) and scroll functionality (scroll bar in test area with source code will scroll all three areas).

Please look at layout example:

enter image description here

I already seen a number of topics that shown how to use row header in scroll pane, like in Text Component Line Number. In this aproach, I have no idea how to add third text area. I am looking for advice, how to create such kind of interface easily. Thank you!

like image 711
syscreat Avatar asked Jul 10 '26 03:07

syscreat


1 Answers

I have no idea how to add third text area

Use a BorderLayout and add the components to left, center and right

[...] and only one text area has a scroll bar. It's required to sync text areas in terms of text lines (wrapped text should not affect code lines) and scroll functionality

Please have a look at following answers:

How to scroll two JTextPane's?

synchronize scrolling of N number of jtables in java swing

like image 104
Lars Avatar answered Jul 17 '26 16:07

Lars



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!