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


Java UIUtil.setBackgroundRecursively方法代碼示例

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


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

示例1: createUIComponents

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void createUIComponents() {
  mySearchField = new FilterComponent("Edu.NewCourse", 5, true) {
    @Override
    public void filter() {
      String filter = getFilter();
      List<Course> filtered = new ArrayList<>();
      for (Course course : myCourses) {
        if (accept(filter, course)) {
          filtered.add(course);
        }
      }
      updateModel(filtered, null);
    }
  };
  UIUtil.setBackgroundRecursively(mySearchField, UIUtil.getTextFieldBackground());
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:17,代碼來源:EduCoursesPanel.java

示例2: setSelected

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
protected final void setSelected(JComponent aComponent, boolean selected) {
  UIUtil.setBackgroundRecursively(aComponent, selected ? getSelectionBackground() : getBackground());
  aComponent.setForeground(selected ? getSelectionForeground() : getForeground());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:GroupedElementsRenderer.java

示例3: customizeComponent

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
protected void customizeComponent(JList list, Object value, boolean isSelected) {
  ListPopupStep<Object> step = myPopup.getListStep();
  boolean isSelectable = step.isSelectable(value);
  myTextLabel.setEnabled(isSelectable);
  if (!isSelected && step instanceof BaseListPopupStep) {
    Color bg = ((BaseListPopupStep)step).getBackgroundFor(value);
    Color fg = ((BaseListPopupStep)step).getForegroundFor(value);
    if (fg != null) myTextLabel.setForeground(fg);
    if (bg != null) UIUtil.setBackgroundRecursively(myComponent, bg);
  }

  if (step.isMnemonicsNavigationEnabled()) {
    final int pos = step.getMnemonicNavigationFilter().getMnemonicPos(value);
    if (pos != -1) {
      String text = myTextLabel.getText();
      text = text.substring(0, pos) + text.substring(pos + 1);
      myTextLabel.setText(text);
      myTextLabel.setDisplayedMnemonicIndex(pos);
    }
  }
  else {
    myTextLabel.setDisplayedMnemonicIndex(-1);
  }

  if (step.hasSubstep(value) && isSelectable) {
    myNextStepLabel.setVisible(true);
    final boolean isDark = ColorUtil.isDark(UIUtil.getListSelectionBackground());
    myNextStepLabel.setIcon(isSelected ? isDark ? AllIcons.Icons.Ide.NextStepInverted
                                                : AllIcons.Icons.Ide.NextStep
                                       : AllIcons.Icons.Ide.NextStepGrayed);
  }
  else {
    myNextStepLabel.setVisible(false);
    //myNextStepLabel.setIcon(PopupIcons.EMPTY_ICON);
  }

  setSelected(myNextStepLabel, isSelected);


  if (myShortcutLabel != null) {
    myShortcutLabel.setText("");
    if (value instanceof ShortcutProvider) {
      ShortcutSet set = ((ShortcutProvider)value).getShortcut();
      if (set != null) {
        Shortcut shortcut = ArrayUtil.getFirstElement(set.getShortcuts());
        if (shortcut != null) {
          myShortcutLabel.setText("     " + KeymapUtil.getShortcutText(shortcut));
        }
      }
    }
    setSelected(myShortcutLabel, isSelected);
    myShortcutLabel.setForeground(isSelected ? UIManager.getColor("MenuItem.acceleratorSelectionForeground") : UIManager.getColor("MenuItem.acceleratorForeground"));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:56,代碼來源:PopupListElementRenderer.java


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