Pages

about my opensource eclipse java applications recently i'm studying GWT and Android

Wednesday, March 30, 2005

how to wrap on and off Text Widget

I don't know is this a best way .

simply rebuild text widget.
keep text and selection.
----
public void createPartControl(Composite parent) {

textArea = new Text(parent,SWT.MULTI|SWT.V_SCROLL|SWT.H_SCROLL);

}

public void setWrap(boolean bool){
Composite parent=textArea.getParent();
String text=textArea.getText();
Point pt=textArea.getSelection();
textArea.dispose();
int style=SWT.H_SCROLL;
if(bool){
style=SWT.WRAP;
}
textArea = new Text(parent,SWT.MULTI|SWT.V_SCROLL|style);
textArea.setText(text);
textArea.setSelection(pt);

parent.layout();

1 comment:

Anonymous said...

Latest news. Viagra, cialis

viagra
cialis
tramadol