Java – how to create scrollable views in eclipse RCP applications?
•
Java
What have I tried so far:
In createpartcontrol:
ScrolledComposite sc = new ScrolledComposite(parent,SWT.V_SCROLL | SWT.H_SCROLL); sc.setLayoutData(new GridData(GridData.FILL_BOTH)); sc.setExpandVertical(true); sc.setExpandHorizontal(true); sc.setSize(ApplicationWorkbenchWindowAdvisor.WIDTH,ApplicationWorkbenchWindowAdvisor.HEIGHT); final TabFolder tabFolder = new TabFolder(sc,SWT.TOP);
But it doesn't work My problem is that if I resize the program window, the scroll bar won't appear in my view Any ideas?
Solution
Javadoc of scrolledcomposite describes two ways to use it, including sample code To sum up:
>You can set the size @ h of the control / composition contained in the scrolledcomposite on the control / composition itself_ 419_ 13 @ > or tell your scrolledcomposite to use the minimum size of its content
At present, neither of you has done it You are setting the size on scrolledcomposite, but it doesn't make much sense unless you don't use layout manager In any case, see the link above for some official sample code
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码