import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; /* * Created on Mar 7, 2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ now is the time for all good men /** * @author mcq * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class TextManglerUI { Display display; Shell shell; Text sourceText; Text destText; Button removeLFButton; Button addLFafterCRButton; Button indentNewParaButton; Button newParaEQ1Button; Button newParaEQ2Button; Button go; Button b; int counter; public static void main (String[] args) { new TextManglerUI().open(); } /** * */ private void open() { display = new Display(); shell = new Shell(display, SWT.SHELL_TRIM); b = new Button(shell, SWT.PUSH); go.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { counter += 1; go.setText("Count = " + counter); } public void widgetDefaultSelected(SelectionEvent e) { } }); go.setText("Push me to start counting."); shell.setLayout(new RowLayout(SWT.VERTICAL)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } }