• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ColorIcon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: calcValueIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
public Icon calcValueIcon(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws EvaluateException {
  final Value value = descriptor.getValue();
  if (value instanceof ObjectReference) {
    try {
      final ObjectReference objRef = (ObjectReference)value;
      final ReferenceType refType = objRef.referenceType();
      final Field valueField = refType.fieldByName("value");
      if (valueField != null) {
        final Value rgbValue = objRef.getValue(valueField);
        if (rgbValue instanceof IntegerValue) {
          @SuppressWarnings("UseJBColor")
          final Color color = new Color(((IntegerValue)rgbValue).value(), true);
          return new ColorIcon(16, 12, color, true);
        }
      }
    }
    catch (Exception e) {
      throw new EvaluateException(e.getMessage(), e);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ColorObjectRenderer.java


示例2: renderElement

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation) {
  boolean qualify = myHelper != null && !myHelper.willBeImported();

  PsiVariable variable = getObject();
  String name = variable.getName();
  if (qualify && variable instanceof PsiField && ((PsiField)variable).getContainingClass() != null) {
    name = ((PsiField)variable).getContainingClass().getName() + "." + name;
  }
  presentation.setItemText(name);

  presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(this, presentation.isReal()));
  presentation.setStrikeout(JavaElementLookupRenderer.isToStrikeout(this));

  if (myHelper != null) {
    myHelper.renderElement(presentation, qualify, true, getSubstitutor());
  }
  if (myColor != null) {
    presentation.setTypeText("", new ColorIcon(12, myColor));
  } else {
    presentation.setTypeText(getType().getPresentableText());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:VariableLookupItem.java


示例3: attachColorIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
private static void attachColorIcon(final PsiElement element, AnnotationHolder holder, String attributeValueText) {
  try {
    Color color = null;
    if (attributeValueText.startsWith("#")) {
      color = ColorUtil.fromHex(attributeValueText.substring(1));
    } else {
      final String hexCode = ColorMap.getHexCodeForColorName(StringUtil.toLowerCase(attributeValueText));
      if (hexCode != null) {
        color = ColorUtil.fromHex(hexCode);
      }
    }
    if (color != null) {
      final ColorIcon icon = new ColorIcon(8, color);
      final Annotation annotation = holder.createInfoAnnotation(element, null);
      annotation.setGutterIconRenderer(new ColorIconRenderer(icon, element));
    }
  }
  catch (Exception ignored) {
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaFxAnnotator.java


示例4: calcValueIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
public Icon calcValueIcon(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws EvaluateException {
  final Value value = descriptor.getValue();
  if (value instanceof ObjectReference) {
    try {
      final ObjectReference objRef = (ObjectReference)value;
      final ReferenceType refType = objRef.referenceType();
      final Field valueField = refType.fieldByName("value");
      if (valueField != null) {
        final Value rgbValue = objRef.getValue(valueField);
        if (rgbValue instanceof IntegerValue) {
          final Color color = new Color(((IntegerValue)rgbValue).value(), true);
          return new ColorIcon(16, 12, color, true);
        }
      }
    }
    catch (Exception e) {
      throw new EvaluateException(e.getMessage(), e);
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:NodeRendererSettings.java


示例5: attachColorIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
private static void attachColorIcon(final PsiElement element, AnnotationHolder holder, String attributeValueText) {
  try {
    Color color = null;
    if (attributeValueText.startsWith("#")) {
      color = ColorUtil.fromHex(attributeValueText.substring(1));
    } else {
      final String hexCode = ColorSampleLookupValue.getHexCodeForColorName(StringUtil.toLowerCase(attributeValueText));
      if (hexCode != null) {
        color = ColorUtil.fromHex(hexCode);
      }
    }
    if (color != null) {
      final ColorIcon icon = new ColorIcon(8, color);
      final Annotation annotation = holder.createInfoAnnotation(element, null);
      annotation.setGutterIconRenderer(new ColorIconRenderer(icon, element));
    }
  }
  catch (Exception ignored) {
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:JavaFxAnnotator.java


示例6: renderColorInt

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@NotNull
private static Result renderColorInt(int value) {
  int alpha = value >>> 24;
  boolean hasAlpha = alpha != 0;

  //noinspection UseJBColor
  final Color color = new Color(value, hasAlpha);
  String result = String.format(Locale.US, "0x%1$08x {a=%2$02d r=%3$02d g=%4$02d b=%5$02d}", value, color.getAlpha(), color.getRed(),
                                color.getGreen(), color.getBlue());
  return new Result(result, new ColorIcon(16, 12, color, true));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AnnotationsRenderer.java


示例7: createLookupBuilder

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@Nonnull
@Override
public LookupElementBuilder createLookupBuilder(@Nonnull VcsRef item) {
  LookupElementBuilder lookupBuilder = super.createLookupBuilder(item);
  if (myColorManager.isMultipleRoots()) {
    lookupBuilder = lookupBuilder
      .withTypeText(getTypeText(item),
                    new ColorIcon(15, VcsLogGraphTable.getRootBackgroundColor(item.getRoot(), myColorManager)),
                    true);
  }
  return lookupBuilder;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:GoToHashOrRefPopup.java


示例8: getLookupElements

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@NotNull
@Override
public List<LookupElement> getLookupElements(String value)
{
	List<LookupElement> list = new ArrayList<LookupElement>();
	for(Map.Entry<String, String> entry : myDefaultColors.entrySet())
	{
		LookupElementBuilder builder = LookupElementBuilder.create(entry.getKey());
		builder = builder.withIcon(new ColorIcon(12, ColorUtil.fromHex(entry.getValue())));
		builder = builder.withTypeText(entry.getValue(), true);
		list.add(builder);
	}
	return list;
}
 
开发者ID:consulo,项目名称:consulo-css,代码行数:15,代码来源:KeywordColorXStyleSheetValue.java


示例9: renderElement

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation)
{
	boolean qualify = myHelper != null && !myHelper.willBeImported();

	PsiVariable variable = getObject();
	String name = variable.getName();
	if(qualify && variable instanceof PsiField && ((PsiField) variable).getContainingClass() != null)
	{
		name = ((PsiField) variable).getContainingClass().getName() + "." + name;
	}
	presentation.setItemText(name);

	presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(this, presentation.isReal()));
	presentation.setStrikeout(JavaElementLookupRenderer.isToStrikeout(this));

	if(myHelper != null)
	{
		myHelper.renderElement(presentation, qualify, true, getSubstitutor());
	}
	if(myColor != null)
	{
		presentation.setTypeText("", JBUI.scale(new ColorIcon(12, myColor)));
	}
	else
	{
		presentation.setTypeText(getType().getPresentableText());
	}
	if(myTailText != null && StringUtil.isEmpty(presentation.getTailText()))
	{
		if(myTailText.startsWith(EQ))
		{
			presentation.appendTailTextItalic(" (" + myTailText + ")", true);
		}
		else
		{
			presentation.setTailText(myTailText, true);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:41,代码来源:VariableLookupItem.java


示例10: calcValueIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@Override
public Icon calcValueIcon(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws EvaluateException
{
	final Value value = descriptor.getValue();
	if(value instanceof ObjectReference)
	{
		try
		{
			final ObjectReference objRef = (ObjectReference) value;
			final ReferenceType refType = objRef.referenceType();
			final Field valueField = refType.fieldByName("value");
			if(valueField != null)
			{
				final Value rgbValue = objRef.getValue(valueField);
				if(rgbValue instanceof IntegerValue)
				{
					@SuppressWarnings("UseJBColor")
					final Color color = new Color(((IntegerValue) rgbValue).value(), true);
					return new ColorIcon(16, 12, color, true);
				}
			}
		}
		catch(Exception e)
		{
			throw new EvaluateException(e.getMessage(), e);
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:30,代码来源:ColorObjectRenderer.java


示例11: getIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
public static Icon getIcon(@NotNull HighlightDisplayLevel level) {
  Icon icon = level.getIcon();
  return icon instanceof HighlightDisplayLevel.ColoredIcon
               ? new ColorIcon(icon.getIconWidth(), ((HighlightDisplayLevel.ColoredIcon)icon).getColor())
               : icon;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:SeverityRenderer.java


示例12: getIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@Override
Icon getIcon(FileColorConfiguration configuration) {
  Color color = myManager.getColor(configuration.getColorName());
  return color == null ? EmptyIcon.ICON_16 : new ColorIcon(16, 13, color, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FileColorSettingsTable.java


示例13: getIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
@NotNull
@Override
public Icon getIcon() {
  final Color color = getCurrentColor();
  return color == null ? EmptyIcon.create(ICON_SIZE) : new ColorIcon(ICON_SIZE, color);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:AndroidColorAnnotator.java


示例14: ColorIconRenderer

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
public ColorIconRenderer(ColorIcon icon, PsiElement element) {
  myIcon = icon;
  myElement = element;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JavaFxAnnotator.java


示例15: setValue

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
public JComponent setValue(@NotNull final Color value) {
  setText("r:" + value.getRed() + ", g:" + value.getGreen() + ", b:" + value.getBlue());
  setIcon(new ColorIcon(13, 11, value, true));
  return this;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:UiInspectorAction.java


示例16: getIcon

import com.intellij.util.ui.ColorIcon; //导入依赖的package包/类
public static Icon getIcon(@Nonnull HighlightDisplayLevel level) {
  Icon icon = level.getIcon();
  return icon instanceof HighlightDisplayLevel.ColoredIcon
         ? new ColorIcon(icon.getIconWidth(), ((HighlightDisplayLevel.ColoredIcon)icon).getColor())
         : icon;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:SeverityRenderer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DataTarget类代码示例发布时间:2022-05-23
下一篇:
Java SimpleCollection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap