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
4
9 comments

Override the createEditor() method and, after calling super, call editor.setHorizontalScrollbarVisible(true) and/or editor.setVerticalScrollbarVisible(true) as needed.

4

Override the createEditor() method and, after calling super

Could please provide me a quick code example?

0

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
0

How is your dialog laid out?

0

Here's the part of the form. I hope this is what you meant. If not please let me know what you need.

<grid id="1af46" binding="panelCode" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">   <margin top="0" left="0" bottom="0" right="0"/>   <constraints>     <grid row="0" column="1" row-span="2" col-span="1" vsize-policy="3" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>   </constraints>   <properties/>   <border type="none"/>   <children>     <component id="e3928" binding="labelCode">       <constraints>         <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>       </constraints>       <properties>         <text value="Source Code"/>       </properties>     </component>     <scrollpane id="c9566" binding="scrollPaneCode" custom-create="true">       <constraints>         <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>       </constraints>       <properties/>       <border type="none"/>       <children/>     </scrollpane>   </children> </grid>

0

You don't need any additional scrollpane around the editor; it'll take care of the scrolling itself.


1

Got it working. I fixed the size of the JDialog and the containing JPanels.

0

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.

1

Please sign in to leave a comment.