java - How to force StyledText to break line in SWT -
i'm trying force styledtext
breake line effects hopeless. instead, extends size of shell width of biggest line.
i trying achieve creating class extends shell
my constructor
super(swt.on_top | swt.no_trim | swt.no_focus | swt.no_scroll); filllayout layout = new filllayout(); layout.marginheight = 1; layout.marginwidth = 1; setlayout(layout); mform = new managedform(this); formtoolkit toolkit = mform.gettoolkit(); body = mform.getform().getbody(); filllayout layout2 = new filllayout(); layout2.spacing = 2; body.setlayout(layout2); body = toolkit.createcomposite(body, swt.border );
and when want insert , show text. that
string text = body = mform.gettoolkit().createcomposite(parent, swt.border); gridlayout l = new gridlayout(); l.marginheight = 0; l.marginwidth = 1; body.setlayout(l); styledtext bodytext = createdisabledtext(body, text); mform.getform().getcontent().pack(); mform.getform().reflow(true); pack(); setvisible(true);
and create disabledtext:
private styledtext createdisabledtext(composite parent, string value) { styledtext t = new styledtext(parent, swt.shadow_none); t.settext(value); t.seteditable(false); t.setlayoutdata(new griddata(swt.fill, swt.top, true, false)); return t; }
all in class extends shell. doing wrong or there method set maxsize?
in createdisabledtext
method, try passing swt.wrap
style styledtext
constructor.
styledtext t = new styledtext(parent, swt.shadow_none | swt.wrap);
Comments
Post a Comment