List of usage examples for org.eclipse.swt.custom StyledText setMarginColor
public void setMarginColor(Color color)
From source file:org.eclipse.swt.snippets.Snippet316.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 316"); shell.setLayout(new FillLayout()); StyledText text = new StyledText(shell, SWT.V_SCROLL | SWT.H_SCROLL); text.setText("StyledText with margins."); Font font = new Font(display, "Tahoma", 14, SWT.ITALIC); text.setText(//from w w w.j av a 2s . c om "\"If you go down to the woods today\nYou'd better not go alone\nIt's lovely down in the woods today\nBut safer to stay at home\""); StyleRange italic = new StyleRange(); italic.font = font; text.setStyleRanges(new int[] { 0, text.getCharCount() }, new StyleRange[] { italic }); text.setMargins(30, 30, 30, 30); Color color = new Color(display, 138, 226, 255); text.setMarginColor(color); shell.setSize(500, 300); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } font.dispose(); color.dispose(); display.dispose(); }