org.eclipse.swt.widgets.Text character limit

I am using org.eclipse.swt.widgets.Text I am doing

Text description = new Text(container, SWT.SINGLE); description.setEditable(false); description.setText("long string");

About half of the text shows up in the wizard that I am creating. I see there is a static int called LIMIT in the API. I have not been able to find where it states there is a preset on the number of characters that the Text can hold. I want to expand this to the number of characters that I need.


Text.LIMIT (2,147,483,647 or 2^31) is the maximum number of characters that can be entered into a text widget. This value can change for each version of eclipse.


As the API mentiones, Text.LIMIT is a hard limit of the underlying native widget implementation. You can set the limit to another value using Text.setTextLimit(), but not larger than Text.LIMIT.

Maybe your text is not showing up, because you are using the single-line version of Text. Try instead

Text description = new Text(container, SWT.MULTI);

If it's also not working, try another widget without this limitation (e.g. StyledText).

人吐槽 人点赞



用户名: 密码:
验证码: 匿名发表


查看评论:org.eclipse.swt.widgets.Text character limit