I created a ScrolledFormText containing a FormText using java and SWT. The problem is that when the window containig this ScrolledFormText opens and i start filling it with text until the text passes the end of the ScrolledFormText a scrollbar doesn't appear although it should, if i resize the window by dragging its edge to make it bigger or even smaller the scroll bar then appears. I would like to know if there is a solution for this problem so that i don't need to resize the window to make the scroll bar appear.
Here is the code responsible of creating the ScrolledFormText in the function:
ScrolledFormText scrolledFormText = new ScrolledFormText(mform.getForm().getBody(), false);
richtextPreview = mform.getToolkit().createFormText(scrolledFormText, false);
scrolledFormText.setFormText(richtextPreview);
mform.getToolkit().adapt(scrolledFormText);
GridData gd_richtextPreview = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gd_richtextPreview.heightHint = 70;
scrolledFormText.setLayoutData(gd_richtextPreview);
mform.getToolkit().paintBordersFor(scrolledFormText);
mform.getToolkit().paintBordersFor(richtextPreview);
richtextPreview.setColor("header", this.getShell().getDisplay().getSystemColor(SWT.COLOR_BLUE));
richtextPreview.setColor("error", this.getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
richtextPreview.setFont("bold", SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
And here is the part that sets the text in FormText:
richtextPreview.setText(buf.toString(), true, true);
richtextPreview.pack();