当前位置: 首页>>代码示例>>Java>>正文


Java Color类代码示例

本文整理汇总了Java中org.eclipse.swt.graphics.Color的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Color类属于org.eclipse.swt.graphics包,在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeColors

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
void initializeColors() {
	Display display = Display.getDefault();
	colors = new Color[] { new Color(display, new RGB(0, 0, 0)), // black
			new Color(display, new RGB(128, 0, 0)), // red
			new Color(display, new RGB(0, 128, 0)), // green
			new Color(display, new RGB(0, 0, 128)) // blue
	};
	tokenColors = new int[MAXIMUM_TOKEN];
	tokenColors[OTHER] = 0;
	tokenColors[NUMBER] = 0;
	tokenColors[WORD] = 0;
	tokenColors[WHITE] = 0;
	tokenColors[COMMENT] = 1;
	tokenColors[STRING] = 2;
	tokenColors[KEY] = 3;
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:17,代码来源:JavaLineStyler.java

示例2: TestProgressBar

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
/**
 * Create instance.
 */
public TestProgressBar(Composite parent, int style) {
	super(parent, style);

	// damn you, SWT color management
	// Color sample is form: http://www.colorpicker.com/c6f2b1
	colorSkipped = new Color(Display.getCurrent(), 230, 232, 235);
	colorPassed = new Color(Display.getCurrent(), 198, 242, 177);
	colorFailed = new Color(Display.getCurrent(), 242, 188, 177);
	colorError = new Color(Display.getCurrent(), 242, 188, 177);
	colorFixme = new Color(Display.getCurrent(), 177, 231, 242);

	addPaintListener((ev) -> {
		onPaint(ev.gc);
	});
	addDisposeListener((ev) -> {
		onDispose();
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:TestProgressBar.java

示例3: getCurrent

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
/**
 * Returns the color this widget will use for the given status. This allows {@link TestResultsView} to reuse these
 * colors.
 */
/* package */final Color getColorForStatus(TestStatus status) {
	if (status != null) {
		switch (status) {
		case SKIPPED_IGNORE: //$FALL-THROUGH$
		case SKIPPED_PRECONDITION: //$FALL-THROUGH$
		case SKIPPED_NOT_IMPLEMENTED: //$FALL-THROUGH$
		case SKIPPED:
			return colorSkipped;
		case PASSED:
			return colorPassed;
		case SKIPPED_FIXME:
			return colorFixme;
		case FAILED:
			return colorFailed;
		case ERROR:
			return colorError;
		default:
			break;
		}
	}
	return getCurrent().getSystemColor(COLOR_WHITE);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:TestProgressBar.java

示例4: update

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
@Override
  public void update(ViewerCell cell) {

      AvroNode node = nodeConverter.convertToAvroNode(cell.getElement());
      
String text = labelProvider.getText(node);
      Image image = labelProvider.getImage(node);
      StyleRange[] styleRanges = labelProvider.getStyleRanges(node);

      cell.setText(text);
cell.setImage(image);
      cell.setStyleRanges(styleRanges);

      Color backgroundColor = labelProvider.getBackgroundColor(node);
      if (backgroundColor != null) {
      	cell.setBackground(backgroundColor);
      }
      
      super.update(cell);
  }
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:21,代码来源:SchemaViewerStyledCellLabelProvider.java

示例5: displayMessage

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
private String displayMessage(String msg, Color color) {
	String formattedDate = dateFormatter.format(System.currentTimeMillis());
	String timeMsg = formattedDate + msg;
	Message m = null;
	synchronized (msgStack) {
		if (!msgStack.isEmpty()) { // merge messages for better performance
			Message lastM = msgStack.lastElement();
			if (lastM != null && lastM.color == color) {
				msgStack.remove(msgStack.size() - 1);
				m = new Message(lastM.msg + "\n" + timeMsg, color);
			}
		}
		if (m == null) {
			m = new Message(timeMsg, color);
		}
		msgStack.push(m);
	}

	Display.getDefault().asyncExec(new Runnable() {
		@Override
		public void run() {
			asyncDisplayMessages();
		}
	});
	return msg;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:SpecProcessPage.java

示例6: AbstractNodeFigure

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
public AbstractNodeFigure(AbstractNodeElement node,Image icon){
	this.node=node;
	BorderLayout layout=new BorderLayout();
	this.setLayoutManager(layout);
	ImageFigure iconFigure=new ImageFigure(icon);
	this.add(iconFigure,BorderLayout.LEFT);
	this.label=new Label(this.node.getLabel());
	this.label.setForegroundColor(ColorConstants.black);
	this.add(this.label,BorderLayout.CENTER);
	this.setAntialias(SWT.ON);
	RGB rgb=Activator.getPreference().getBorderColor();
	this.setForegroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
	rgb=Activator.getPreference().getBackgroundColor();
	this.setBackgroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
	this.setLineWidth(2);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:17,代码来源:AbstractNodeFigure.java

示例7: allButtonListener

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
/**
 * The function will change selected text background color.
 * @param styledText
 * @param text
 * @param foreground
 * @param background
 */
public void allButtonListener(StyledText styledText, String text, Color foreground, Color background, Label label){
	logger.debug("StyledText All button selected");
	int index = 0;
	int recordCount = 0;
	if(styledText == null){return;}
	for(;index < styledText.getText().length();){
		  int lastIndex = StringUtils.indexOf(StringUtils.lowerCase(styledText.getText()), StringUtils.lowerCase(text), index);
		  
		  if(lastIndex < 0){return;}
		  else{
			  setStyledRange(styledText, lastIndex, text.length(), null, background);
			  index = lastIndex + 1;
			  recordCount++ ;
			  label.setVisible(true);
			  label.setText("Matching count - " + recordCount);
		  }
	  }
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:StyledTextEventListener.java

示例8: setStyledText

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
private void setStyledText(ViewerCell cell, TreeObject obj) {
	/* Calcul du texte. */
	String mainText = obj.getMainText();
	if (mainText == null) {
		return;
	}
	String subText = obj.getSubText();
	String subTextFinal = subText == null ? "" : (" : " + subText);
	String fullText = mainText + subTextFinal;
	cell.setText(fullText);

	/* Calcul du style. */
	List<StyleRange> styles = new ArrayList<>();
	StyleRange styleMainText = new StyleRange(0, mainText.length(), null, null);
	styles.add(styleMainText);
	if (!subTextFinal.isEmpty()) {
		Display display = Display.getCurrent();
		Color blue = display.getSystemColor(SWT.COLOR_DARK_YELLOW);
		StyleRange styleSubText = new StyleRange(mainText.length(), subTextFinal.length(), blue, null);
		styles.add(styleSubText);
	}
	cell.setStyleRanges(styles.toArray(new StyleRange[0]));
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:24,代码来源:KspOutlinePage.java

示例9: createComposite

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
/**
 * This method initializes composite	
 *
 */
private void createComposite() {
	GridData gridData7 = new org.eclipse.swt.layout.GridData();
	gridData7.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData7.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	GridData gridData4 = new org.eclipse.swt.layout.GridData();
	gridData4.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData4.grabExcessHorizontalSpace = false;
	gridData4.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	GridLayout gridLayout4 = new GridLayout();
	gridLayout4.numColumns = 2;
	compositeOutputFooter = new Composite(compositeOutput, SWT.NONE);
	compositeOutputFooter.setBackground(new Color(Display.getCurrent(), 162, 194, 250));
	compositeOutputFooter.setLayout(gridLayout4);
	compositeOutputFooter.setLayoutData(gridData4);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:20,代码来源:SequenceEditorPart.java

示例10: ValueSourceImpl

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
private
ValueSourceImpl(
	String					_name,
	int						_index,
	Color[]					_colours,
	boolean					_is_up,
	boolean					_trimmable,
	boolean					_is_dotted )
{
	name			= _name;
	index			= _index;
	colours			= _colours;
	is_up			= _is_up;
	trimmable		= _trimmable;
	is_dotted		= _is_dotted;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:17,代码来源:DownloadActivityView.java

示例11: updateColor

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
public static void updateColor(TableCell cell, DownloadManager dm, boolean show_errors ) {
	if (dm == null || cell == null)
		return;

	if ( show_errors ){
		if ( dm.isTrackerError()){
			cell.setForegroundToErrorColor();
			return;
		}
	}
	TRTrackerScraperResponse response = dm.getTrackerScrapeResponse();
	if (response instanceof TRTrackerBTScraperResponseImpl && response.getStatus() == TRTrackerScraperResponse.ST_ONLINE) {
		boolean bMultiHashScrapes = ((TRTrackerBTScraperResponseImpl) response).getTrackerStatus().getSupportsMultipeHashScrapes();
		Color color = (bMultiHashScrapes) ? null : Colors.grey;
		cell.setForeground(Utils.colorToIntArray(color));
	}else{
		cell.setForeground(Utils.colorToIntArray(null));
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:20,代码来源:TrackerCellUtils.java

示例12: disposeColors

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
/**
 * Dispose of all the cached {@link Color}'s.
 */
public static void disposeColors() {
	for (Color color : m_colorMap.values()) {
		color.dispose();
	}
	m_colorMap.clear();
}
 
开发者ID:nbfontana,项目名称:pdi,代码行数:10,代码来源:SWTResourceManager.java

示例13: toColor

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
private Color toColor(OutputStreamType type) {
	switch (type) {
	case STD_OUT:
		return getDisplay().getSystemColor(COLOR_LIST_FOREGROUND);
	case STD_ERR:
		return getDisplay().getSystemColor(COLOR_RED);
	default:
		throw new IllegalArgumentException("Unexpected output stream type.");
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:ConsoleOutputStreamProvider.java

示例14: initialize

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
protected void initialize() {
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	cicsData = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	cicsData.setEditable(false);
	cicsData.setBackground(new Color(null,253,253,244));
	cicsData.setFont(new Font(null,"Courier New",10,1));
	cicsData.setLayoutData(gridData);
	cicsData.setText("");
	this.setLayout(new GridLayout());
	setSize(new Point(300, 200));
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:16,代码来源:CicsConnectorComposite.java

示例15: setTwistieForeground

import org.eclipse.swt.graphics.Color; //导入依赖的package包/类
/**
 * Delegating to the <code>TwistieLabel</code>
 * @param color
 */

public void setTwistieForeground(Color color) {
	if (null != label && !label.isDisposed()) {
		label.setTwistieForeground(color);
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:11,代码来源:TwistieSection.java


注:本文中的org.eclipse.swt.graphics.Color类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。