| |

VerySource

 Forgot password?
 Register
Search
View: 841|Reply: 3

A question about JScrollPane automatic scrolling

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-28 17:00:01
| Show all posts |Read mode
I used class A to define an interface with a JScrollPane and JTextArea, and set the horizontal scroll bar not to appear, and the vertical scroll bar to appear when necessary. I passed this JTextArea to the construction method of another class B, and then I modified the content of JTextArea in class B. Logically, when the content of JTextArea exceeds the size of the text area, the scroll bar will automatically track to the end of the text, right? , But it doesn’t work in some programs. I have tried it. When I modify the content of JTextArea in class A, the scroll bar can be tracked automatically, but once there is any modification in class B, it won’t work. Why is that? Method to solve? Seniors, please advise!
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-9-29 23:15:02
| Show all posts
Why not call the method of modifying JTextArea of ​​class A in class B.
Reply

Use magic Report

1

Threads

51

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-9-29 23:30:01
| Show all posts
B EXTENDS A is changed again, LZ has made it so complicated, why is it so complicated? I am dizzy, and people are also dizzy.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

 Author| Post time: 2020-9-30 21:45:01
| Show all posts
The purpose of what I wrote is to separate the realization of the interface from the realization of the function. I think my structure is reasonable, but I am really stumped by such a problem. I hope you seniors and masters can give me some advice.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list