Display display = Display.getCurrent(); Color blue = display.getSystemColor(SWT.COLOR_BLUE); Color listBackground = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
/** * Create a managed color by specifying the color (SWT.COLOR_*) * * @param display * @param color */ public ManagedColor( Display display, int color ) { this.color = display.getSystemColor( color ); this.systemColor = false; }
/** * Returns the system {@link Color} matching the specific ID. * * @param systemColorID * the ID value for the color * @return the system {@link Color} matching the specific ID */ public static Color getColor(int systemColorID) { Display display = Display.getCurrent(); return display.getSystemColor(systemColorID); } /**
@Override protected void configureShell( Shell shell ) { super.configureShell( shell ); shell.setBackground( shell.getDisplay().getSystemColor( DIALOG_COLOR ) ); shell.setBackgroundMode( SWT.INHERIT_FORCE ); } };
private StyleRange getValueStyle() { StyleRange style1 = new StyleRange(); style1.fontStyle = SWT.NORMAL; style1.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE); return style1; }
private StyleRange getKeyStyle() { StyleRange style = new StyleRange(); style.fontStyle = SWT.BOLD; style.foreground = Display.getDefault().getSystemColor(SWT.COLOR_RED); return style; } }
/** * Overridden to make the shell background white. * * @param shell */ @Override protected void configureShell( Shell shell ) { super.configureShell( shell ); shell.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WHITE ) ); shell.setBackgroundMode( SWT.INHERIT_FORCE ); }
@Override protected void configureShell( Shell shell ) { super.configureShell( shell ); shell.setBackground( shell.getDisplay().getSystemColor( DIALOG_COLOR ) ); shell.setBackgroundMode( SWT.INHERIT_FORCE ); } };
public Translator( Display display ) { this.display = display; this.log = new LogChannel( APP_NAME ); this.props = PropsUI.getInstance(); clear(); unusedColor = display.getSystemColor( SWT.COLOR_YELLOW ); }
@Override public void setEnabled( boolean enabled ) { styledText.setEnabled( enabled ); // StyledText component does not get the "disabled" look, so it needs to be applied explicitly // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=4745 if ( Display.getDefault() != null ) { Color foreground = Display.getDefault().getSystemColor( enabled ? SWT.COLOR_BLACK : SWT.COLOR_DARK_GRAY ); Color background = Display.getDefault().getSystemColor( enabled ? SWT.COLOR_WHITE : SWT.COLOR_WIDGET_BACKGROUND ); styledText.setForeground( foreground ); styledText.setBackground( background ); } } }
public void setActive() { wlLogfile.setEnabled( jobEntry.setLogfile ); wLogfile.setEnabled( jobEntry.setLogfile ); wlLogext.setEnabled( jobEntry.setLogfile ); wLogext.setEnabled( jobEntry.setLogfile ); wlAddDate.setEnabled( jobEntry.setLogfile ); wAddDate.setEnabled( jobEntry.setLogfile ); wlAddTime.setEnabled( jobEntry.setLogfile ); wAddTime.setEnabled( jobEntry.setLogfile ); wlLoglevel.setEnabled( jobEntry.setLogfile ); wLoglevel.setEnabled( jobEntry.setLogfile ); wlAppendLogfile.setEnabled( jobEntry.setLogfile ); wAppendLogfile.setEnabled( jobEntry.setLogfile ); if ( jobEntry.setLogfile ) { wLoglevel.setForeground( display.getSystemColor( SWT.COLOR_BLACK ) ); } else { wLoglevel.setForeground( display.getSystemColor( SWT.COLOR_GRAY ) ); } }
composite.setLayout( compLayout ); composite.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) ); imageLabel.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) ); FormData fdImageLabel = new FormData(); fdImageLabel.left = new FormAttachment( 0, 0 ); titleLabel.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) ); titleLabel.setFont( GUIResource.getInstance().getFontBold() ); FormData fdTitleLabel = new FormData(); line.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) ); FormData fdLine = new FormData(); fdLine.left = new FormAttachment( imageLabel, 5 ); messageLabel.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) ); FormData fdMessageLabel = new FormData(); fdMessageLabel.left = new FormAttachment( imageLabel, 20 ); disable.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) ); disable.setSelection( false ); FormData fdDisable = new FormData();
public void drawPentahoGradient( Display display, GC gc, Rectangle rect, boolean vertical ) { if ( !vertical ) { gc.setForeground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) ); gc.setBackground( GUIResource.getInstance().getColorPentaho() ); gc.fillGradientRectangle( rect.x, rect.y, 2 * rect.width / 3, rect.height, vertical ); gc.setForeground( GUIResource.getInstance().getColorPentaho() ); gc.setBackground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) ); gc.fillGradientRectangle( rect.x + 2 * rect.width / 3, rect.y, rect.width / 3 + 1, rect.height, vertical ); } else { gc.setForeground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) ); gc.setBackground( GUIResource.getInstance().getColorPentaho() ); gc.fillGradientRectangle( rect.x, rect.y, rect.width, 2 * rect.height / 3, vertical ); gc.setForeground( GUIResource.getInstance().getColorPentaho() ); gc.setBackground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) ); gc.fillGradientRectangle( rect.x, rect.y + 2 * rect.height / 3, rect.width, rect.height / 3 + 1, vertical ); } }
final Composite composite = new Composite( wTree, SWT.NONE ); if ( !isCarbon ) { composite.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
final Composite composite = new Composite( wTree, SWT.NONE ); if ( !isCarbon ) { composite.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
final Composite composite = new Composite( wTree, SWT.NONE ); if ( !isCarbon ) { composite.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
final Color green = display.getSystemColor (SWT.COLOR_GREEN); final Color orig = shell.getBackground();
item.setText( 2, meta.getMeasure().getFieldName() ); item.setForeground( Display.getCurrent().getSystemColor( SWT.COLOR_DARK_GREEN ) );
public void getData() { fixedFontData = props.getFixedFont(); fixedFont = new Font( display, fixedFontData ); graphFontData = props.getGraphFont(); graphFont = new Font( display, graphFontData ); noteFontData = props.getNoteFont(); noteFont = new Font( display, noteFontData ); backgroundRGB = props.getBackgroundRGB(); if ( backgroundRGB == null ) { backgroundRGB = display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ).getRGB(); } background = new Color( display, backgroundRGB ); graphColorRGB = props.getGraphColorRGB(); graphColor = new Color( display, graphColorRGB ); tabColorRGB = props.getTabColorRGB(); tabColor = new Color( display, tabColorRGB ); }
item.setForeground( Display.getCurrent().getSystemColor( SWT.COLOR_DARK_GREEN ) );