热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.eclipse.swt.widgets.Control.setForeground()方法的使用及代码示例

本文整理了Java中org.eclipse.swt.widgets.Control.setForeground()方法的一些代码示例,展示了Control.

本文整理了Java中org.eclipse.swt.widgets.Control.setForeground()方法的一些代码示例,展示了Control.setForeground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Control.setForeground()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Control
类名称:Control
方法名:setForeground

Control.setForeground介绍

[英]Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.

Note: This operation is a hint and may be overridden by the platform.
[中]将接收器的前景色设置为参数指定的颜色,如果参数为null,则设置为控件的默认系统颜色。
注意:此操作是一个提示,可能会被平台覆盖。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

/**
* Sets the color of the title bar foreground when TITLE_BAR style is used.
*
* @param color
* the title bar foreground
*/
public void setTitleBarForeground(Color color) {
titleBarForeground = color;
if (textLabel != null)
textLabel.setForeground(color);
}

代码示例来源:origin: com.diffplug.durian/durian-swt

/** Sets the foreground color of the given composite and all of its children, recursively. */
public static void setForegroundDeep(Composite root, Color foreground) {
forEachDeep(root, ctl -> ctl.setForeground(foreground));
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
protected void setForeground(Color color) {
getControl().setForeground(color);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

/**
* Sets the color of the title bar foreground when TITLE_BAR style is used.
*
* @param color
* the title bar foreground
*/
public void setTitleBarForeground(Color color) {
if (hasTitleBar())
titleBarForeground = color;
if (textLabel != null)
textLabel.setForeground(color);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

/**
* Utility to set the foreground and the background color of the given
* control
*
* @param control the control to modify
* @param foreground the color to use for the foreground
* @param background the color to use for the background
*/
private static void setColor(Control control, Color foreground, Color background) {
control.setForeground(foreground);
control.setBackground(background);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
* Utility to set the foreground and the background color of the given
* control
*
* @param control the control to modify
* @param foreground the color to use for the foreground
* @param background the color to use for the background
*/
private static void setColor(Control control, Color foreground, Color background) {
control.setForeground(foreground);
control.setBackground(background);
}

代码示例来源:origin: org.eclipse.recommenders.extdoc/rcp

public static void setInfoForegroundColor(final Control c) {
final Display display = c.getDisplay();
final Color color = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
c.setForeground(color);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

/**
* Sets the foreground of the section.
*
* @param fg
* the new foreground.
*/
@Override
public void setForeground(Color fg) {
super.setForeground(fg);
if (descriptionControl != null
&& (getExpansionStyle() & DESCRIPTION) != 0)
descriptionControl.setForeground(fg);
}

代码示例来源:origin: org.eclipse.neoscada.hmi/org.eclipse.scada.da.ui.widgets

private static void applyWidget ( final Control label, final CurrentStyle style )
{
label.setForeground ( style.foreground );
label.setBackground ( style.background );
label.setFont ( style.font );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

/**
* Sets the foreground of all the custom controls in the expandable.
*/
@Override
public void setForeground(Color fg) {
super.setForeground(fg);
if (textLabel != null)
textLabel.setForeground(fg);
if (toggle != null)
toggle.setForeground(fg);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

/**
* Sets the foreground of all the custom controls in the expandable.
*/
@Override
public void setForeground(Color fg) {
super.setForeground(fg);
if (textLabel != null)
textLabel.setForeground(fg);
if (toggle != null)
toggle.setForeground(fg);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

/** Helper function to avoid setting colors unnecessarily */
public static void setForeground(Control control, Color newColor) {
if (!equals(control.getForeground(), newColor)) {
control.setForeground(newColor);
}
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

/**
* Sets the foreground of the control and its content.
*
* @param fg
* the new foreground color
*/
@Override
public void setForeground(Color fg) {
super.setForeground(fg);
if (getContent() != null)
getContent().setForeground(fg);
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected void setForeground(Color color) {
getControl().setForeground(color);
fForegroundColorRGB= color.getRGB();
refresh();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

@Override
public void paintControl(PaintEvent e) {
if (textLabel instanceof Label && !isFixedStyle())
textLabel.setForeground(toggle.hover ? toggle
.getHoverDecorationColor()
: getTitleBarForeground());
}
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

@Override
public void paneChanged(String newPaneID) {
if (newPaneID.equals(DefaultDetailPane.ID)){
fDetailPane.getCurrentControl().setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
fDetailPane.getCurrentControl().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void setColorAndFont(Control control, Color foreground, Color background, Font font) {
control.setForeground(foreground);
control.setBackground(background);
control.setFont(font);
if (control instanceof Composite) {
Control[] children= ((Composite) control).getChildren();
for (int i= 0; i setColorAndFont(children[i], foreground, background, font);
}
}
}

代码示例来源:origin: org.eclipse.xtext/ui

private void setColorAndFont(Control control, Color foreground, Color background, Font font) {
control.setForeground(foreground);
control.setBackground(background);
control.setFont(font);
if (control instanceof Composite) {
Control[] children= ((Composite) control).getChildren();
for (int i= 0; i setColorAndFont(children[i], foreground, background, font);
}
}
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

/**
* Overrides 'super' to pass the proper colors and font
*/
@Override
public void setContent(Control content) {
super.setContent(content);
if (content != null) {
content.setForeground(getForeground());
content.setBackground(getBackground());
content.setFont(getFont());
}
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

/**
* Overrides 'super' to pass the proper colors and font
*/
@Override
public void setContent(Control content) {
super.setContent(content);
if (content != null) {
content.setForeground(getForeground());
content.setBackground(getBackground());
content.setFont(getFont());
}
}

推荐阅读
author-avatar
tomodachitch
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有