當前位置: 首頁>>代碼示例>>Java>>正文


Java UIUtil.getTreeForeground方法代碼示例

本文整理匯總了Java中com.intellij.util.ui.UIUtil.getTreeForeground方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.getTreeForeground方法的具體用法?Java UIUtil.getTreeForeground怎麽用?Java UIUtil.getTreeForeground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.ui.UIUtil的用法示例。


在下文中一共展示了UIUtil.getTreeForeground方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: customizeRendererText

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
protected void customizeRendererText(ColoredTreeCellRenderer renderer) {
  final StringBuilder buffer = new StringBuilder(128);
  final PsiClass containingClass = myMethod.getContainingClass();
  if (containingClass != null) {
    buffer.append(ClassPresentationUtil.getNameForClass(containingClass, false));
    buffer.append('.');
  }
  final String methodText = PsiFormatUtil.formatMethod(
    myMethod,
    PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
    PsiFormatUtil.SHOW_TYPE
  );
  buffer.append(methodText);

  final SimpleTextAttributes attributes = isEnabled() ?
                                          new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground()) :
                                          SimpleTextAttributes.EXCLUDED_ATTRIBUTES;
  renderer.append(buffer.toString(), attributes);

  if (containingClass != null) {
    final String packageName = getPackageName(containingClass);
    renderer.append("  (" + packageName + ")", new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, JBColor.GRAY));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:JavaMethodNode.java

示例2: paintLabel

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void paintLabel(Graphics g, int cell, Rectangle cellBounds, @Nullable String label, int thumbnailHeight) {
  if (!StringUtil.isEmpty(label)) {
    final Color fg;
    if (hasFocus() && cell == mySelectedIndex && (getImage(cell) != null || UIUtil.isUnderDarcula())) {
      fg = UIUtil.getTreeSelectionForeground();
    }
    else {
      fg = UIUtil.getTreeForeground();
    }
    GraphicsUtil.setupAntialiasing(g);
    g.setColor(fg);
    FontMetrics fontMetrics = g.getFontMetrics();
    LineMetrics metrics = fontMetrics.getLineMetrics(label, g);
    int width = fontMetrics.stringWidth(label);

    int textBoxTop = myCellMargin.top + thumbnailHeight;
    int cellBottom = cellBounds.height - myCellMargin.bottom;

    int textY = cellBounds.y + (cellBottom + textBoxTop + (int)(metrics.getHeight() - metrics.getDescent())) / 2 ;
    int textX = (cellBounds.width - myCellMargin.left - myCellMargin.right - width) / 2 + cellBounds.x + myCellMargin.left;
    g.drawString(label, textX, textY);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ASGallery.java

示例3: setUI

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void setUI(final TreeUI ui) {
  super.setUI(ui);

  // [vova] we cannot create this hash in constructor and just clear it here. The
  // problem is that setUI is invoked by constructor of superclass.
  myHighlightAttributes = new HashMap<HighlightSeverity, Map<SimpleTextAttributes, SimpleTextAttributes>>();

  final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
  final TextAttributes attributes = globalScheme.getAttributes(JavaHighlightingColors.STRING);

  myBindingAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, UIUtil.getTreeForeground());
  myClassAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground());
  myPackageAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, Color.GRAY);
  myTitleAttributes =new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, attributes.getForegroundColor());
  myUnknownAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_WAVED, Color.RED);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ComponentTree.java

示例4: append

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
/**
 * When the item is selected then we use default tree's selection foreground.
 * It guaranties readability of selected text in any LAF.
 */
@Override
public void append(@NotNull @Nls String fragment, @NotNull SimpleTextAttributes attributes, boolean isMainText) {
  if (mySelected && isFocused()) {
    super.append(fragment, new SimpleTextAttributes(attributes.getStyle(), UIUtil.getTreeSelectionForeground()), isMainText);
  }
  else if (mySelected && UIUtil.isUnderAquaBasedLookAndFeel()) {
    super.append(fragment, new SimpleTextAttributes(attributes.getStyle(), UIUtil.getTreeForeground()), isMainText);
  }
  else {
    super.append(fragment, attributes, isMainText);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ColoredTreeCellRenderer.java

示例5: getSelectionForeground

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
protected Color getSelectionForeground(@NotNull final JTree tree) {
  return myMacTreeUI && !tree.hasFocus() ? UIUtil.getTreeForeground() : UIUtil.getTreeSelectionForeground();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:JBDefaultTreeCellRenderer.java

示例6: getTreeForeground

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@NotNull
public static Color getTreeForeground(boolean selected) {
  return selected ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeForeground();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:TreeUtil.java


注:本文中的com.intellij.util.ui.UIUtil.getTreeForeground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。