Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The scrollbar is unable for uneditable JTextArea?

 
Shen Lin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks to Cindy Glass and Dirk Schreckmann. I nearly finished my program. Here is the last problem of it. I have a Frame, which merely shows how to use my GUI. I set the textarea on this frame to be uneditable and the text size outgrows the height of the frame. I, therefore, want to add vertical scrollbar to this frame. But I can't drag the scrollbar even when I set verticalScrollPolicy of JScrollPane to be JScrollPane.VERTICAL_SCROLLBAR_ALWAYS. How can I make the scrollbar available? Here is the code:
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have never set the policies.

You need to move them to JScrollPane from the JTextArea.

Like the above.
 
Shen Lin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. I fixed it. (What a stupid mistake!!)
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We all make them. Some are just more public.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic