Does SWT StyledText have a height limit?

I am trying to create an application containing a StyledText window displayed in ScrolledComposite. I'm having difficulty displaying a large number of lines in my StyledText block (over 2,550 seem to cause problems).

The StyledText field should not have a scrollbar, but it should scroll through a ScrolledComposite. Since there are other elements below and above StyledText that need to be scrolled, and I don't need a few scroll bars.

Therefore, with large amounts of data, I have a very large (as in height) StyledText window, which seems to stop after a certain height.

Screen shot

, StyledText , , . , StyledText , .

, :

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;


public class ExpandBox2
{
    public static void main(String[] args)
    {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setText("Example");
        shell.setLayout(new FillLayout());

        ScrolledComposite scrolledComposite = new ScrolledComposite(shell, SWT.V_SCROLL);
        scrolledComposite.setLayout(new FillLayout(SWT.VERTICAL));

            Composite mainComp = new Composite(scrolledComposite, SWT.NONE);
        mainComp.setLayout(new FillLayout(SWT.VERTICAL));

        StyledText styledText = new StyledText(mainComp, SWT.NONE);
        styledText.getContent().setText(bigString());

        mainComp.setSize(mainComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));

        scrolledComposite.setContent(mainComp);
        scrolledComposite.setMinSize(mainComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        scrolledComposite.setExpandHorizontal(true);
        scrolledComposite.setExpandVertical(true);
        scrolledComposite.getVerticalBar().setIncrement(10);


        shell.setSize(400, 350);
        shell.open();
        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) {
                display.sleep ();
            }
        }
        display.dispose();

    }

    private static String bigString()
    {
        String big = "";

        for(int i=0;i<10000;i++)
        {
            big = big + "hello\r\n";
        }

        return big;
    }

}

: , SWT Label SWT Text

+3
2

Windows. , 32767 (, ).

scrolledComposite, 32767, . , mainComp > 32767, , .

, Eclipse , , / Windows: https://bugs.eclipse.org/bugs/show_bug.cgi?id=333111

+4

, , " " StyledText? StyledText ScrolledComposite. StyledText , (, VerifyListener), - , .

:

, , , ( , - styledText.addListener(SWT.Resize, new Listener() ...).

0

Source: https://habr.com/ru/post/1781674/


All Articles