import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class TextBold {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
StyledText text = new StyledText(shell, SWT.BORDER);
text.setText("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
StyleRange style1 = new StyleRange();
style1.start = 0;
style1.length = 10;
style1.fontStyle = SWT.BOLD;
text.setStyleRange(style1);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
|