EditorTextField and surrounding JBScrollPane
How do I make an EditorTextField scrollable?
I tried to wrap it with an JBScrollPane which gives me some strange results.
I cannot use the mouse wheel an the horizantal scrollbar does not appear as it should.
Attachment(s):
Screenshot 2015-03-08 16.29.31.png
Screenshot 2015-03-08 16.29.21.png
Please sign in to leave a comment.
Override the createEditor() method and, after calling super, call editor.setHorizontalScrollbarVisible(true) and/or editor.setVerticalScrollbarVisible(true) as needed.
Could please provide me a quick code example?
https://github.com/JetBrains/intellij-community/blob/master/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerStatementEditor.java#L55
Thanks Dmitry.
The vertical scrolling works great now. But the horizontal scrollbar does not appear instead the editor gets stretched to fit the codes width.
See attached screenshot.
Attachment(s):
Screenshot 2015-03-09 11.08.33.png
How is your dialog laid out?
Here's the part of the form. I hope this is what you meant. If not please let me know what you need.
You don't need any additional scrollpane around the editor; it'll take care of the scrolling itself.
Got it working. I fixed the size of the JDialog and the containing JPanels.
Thank you @Dmitry. You made my day! After two resultless days working on `JBScrollPane`, I found this post finally. Please provide the Scrolling behavior as a standard API in `EditorTextField` class. Without such forums, it takes forever to find the solution.