本文整理匯總了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());
}
示例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());
}
示例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"));
}
}