Mega Code Archive

 
Categories / Java Tutorial / SWT
 

StyleRange Constructors

Constructor Description StyleRange()Creates an empty StyleRange. StyleRange(int start, int length, Color foreground, Color background)Creates a StyleRange with the specified start, length, foreground color, and background color. StyleRange(int start, int length, Color foreground, Color background, int fontStyle)Creates a StyleRange with the specified start, length, foreground color, background color, and font style. The following code creates two identical StyleRange objects: StyleRange sr1 = new StyleRange(); sr1.start = 7; sr1.length = 14; sr1.foreground = display.getSystemColor(SWT.COLOR_GREEN); sr1.background = display.getSystemColor(SWT.COLOR_WHITE); sr1.fontStyle = SWT.BOLD; StyleRange sr2 = new StyleRange(7, 14, display.getSystemColor(SWT.COLOR_GREEN), display.getSystemColor(SWT.COLOR_WHITE), SWT.BOLD);