package testprogs; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; public class ImeSWTTest { public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(display); GridLayout l = new GridLayout(1, false); shell.setLayout(l); Label label = new Label(shell, SWT.NONE); label.setText("Text:"); label.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); StyledText st = new StyledText(shell, SWT.WRAP); GridData ld = new GridData(30, 100); ld.horizontalAlignment = SWT.FILL; st.setLayoutData(ld); Composite comp = new Composite(shell, SWT.NONE); l = new GridLayout(10, true); comp.setLayout(l); final char[] chars = new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', '\u2191', 'y', 'x', 'c', 'v', 'b', 'n', 'm', '\u2190', '\u2192', '\u2193'}; for (int i = 0; i < 4; i++) { int n = 10; for (int j = 0; j < 10; j++) { Button b = new Button(comp, SWT.NONE); b.setText(String.valueOf(chars[i*n + j])); b.setLayoutData(new GridData(30, 30)); } } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }