setting scrollbar in jtextarea
hi
Consider a JSplitPanel. in that split panel i have added jtree as the left component, and jScrollpane as the right component. if the user click a node in the jtree, i use the setDividerLocation method to divide the splite pand and add a jscrollpane at right side. in that jscrollpane i added a jtext area with the horizontal scrollbar option which will show always. thing is working well. scrollbar showing when the jscrollpane get visible. the problem is if the text of the text area is go beyond than the jtextarea viewport there is no change in scrollbar. it is showing lik dummy scrollbar without any changes.
What i have to do to activate the scrollbar if the text in the jtextarea execde it view area?
# 1
If you need help then you need to create a Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the Code Formatting Tags so the code retains its original formatting.
regards
Aniruddha
# 4
I devided JScrollPane Vertically. i added a jtree as left side component of JScrollPane. i did't add anythin in the right side.
if the user click a node in the JTree which is added in the left side of the jScrollpane, then i add a new jscrollpane as the right side component.
In that jscrollpane i added a JText area.
The JTextArea which i created earlier set the vertical scroll bar policy as always. so the vertical scrollbar will be shown always.
The above things working correctly.
What is wrong is,
if the user type any text more than text area, the scrollbar should be activated lik in our forums(text area). But it dos't happen to me. the empty jscrollbar is displayed eventhough the user enter more data that can't be displayed in the jtext area.
MyAction is,
if the user click the jtree, i call the setDivider location to devide the JSplitpane. so the left side componet(JTree) uses 200 as width all other width in the screen will be allocated to the JSplitPane(contains the JTextarea).
My question is,
why the JScrollbar is not activated are perform correctly eventhough the data which is entered in the JTextArea execedes the row(example 40) which i specified in the constructer when i create the jTextArea?
# 5
> if i write code means it will go more than 100 lines.
We didn't ask for your real code. We asked for code that demonstrates the problem. So isolate the problem and then post your SSCCE. I have never had the scrollbars not work correctly in a JTextArea, so I can't begin to guess what you are doing wrong.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.