i have a problem with my Java SWT ScrolledComposite:
In a (centered) ScrolledComposite are displayed many pictures previews (see picture images). If the images in the ScrolledComposite are loaded, it takes a long time. After that the previews lags on scolling.
Quick: it has a really poor performance. So my idea: i calculate the scoll bar and load only the displayed pictures. If the user scoll down, it will be load the other pictures.
My (test) code:
Composite center = new Composite(form, SWT.NONE);
center.setLayout(new FillLayout());
ScrolledComposite centerScrolledComposite = new ScrolledComposite(center, SWT.V_SCROLL | SWT.BORDER);
Display display = getDisplay();
Image image1 = display.getSystemImage(SWT.ICON_WORKING);
Image image2 = display.getSystemImage(SWT.ICON_QUESTION);
Image image3 = display.getSystemImage(SWT.ICON_ERROR);
Composite wrappedScrolledComposite = new Composite(centerScrolledComposite, SWT.NONE);
for (int i = 0; i <= 5000; i++)
{
Label label = new Label(wrappedScrolledComposite, SWT.NONE);
if (i % 3 == 0)
label.setImage(image1);
if (i % 3 == 1)
label.setImage(image2);
if (i % 3 == 2)
label.setImage(image3);
}
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.wrap = true;
wrappedScrolledComposite.setLayout(layout);
centerScrolledComposite.setContent(wrappedScrolledComposite);
centerScrolledComposite.setExpandHorizontal(true);
centerScrolledComposite.setExpandVertical(true);
centerScrolledComposite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Rectangle r = centerScrolledComposite.getClientArea();
centerScrolledComposite.setMinSize(wrappedScrolledComposite.computeSize(r.width, SWT.DEFAULT));
}
});
But.. i don't know if it's possible. Have anybody a similar problem? Thanks
PS: i need a view very simular to the Windows 10 File Browser with "Big Icos" as preview.... and the same performance :)