本文整理匯總了Java中com.intellij.ide.navigationToolbar.NavBarItem.isFocused方法的典型用法代碼示例。如果您正苦於以下問題:Java NavBarItem.isFocused方法的具體用法?Java NavBarItem.isFocused怎麽用?Java NavBarItem.isFocused使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.ide.navigationToolbar.NavBarItem
的用法示例。
在下文中一共展示了NavBarItem.isFocused方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doPaintNavBarItem
import com.intellij.ide.navigationToolbar.NavBarItem; //導入方法依賴的package包/類
@Override
public void doPaintNavBarItem(Graphics2D g, NavBarItem item, NavBarPanel navbar) {
final boolean floating = navbar.isInFloatingMode();
boolean toolbarVisible = UISettings.getInstance().SHOW_MAIN_TOOLBAR;
final boolean selected = item.isSelected() && item.isFocused();
boolean nextSelected = item.isNextSelected() && navbar.hasFocus();
Map<ImageType, BufferedImage> cached = myCache.get(item);
ImageType type;
if (floating) {
type = selected ? ImageType.ACTIVE_FLOATING : nextSelected ? ImageType.NEXT_ACTIVE_FLOATING : ImageType.INACTIVE_FLOATING;
} else {
if (toolbarVisible) {
type = selected ? ImageType.ACTIVE : nextSelected ? ImageType.NEXT_ACTIVE : ImageType.INACTIVE;
} else {
type = selected ? ImageType.ACTIVE_NO_TOOLBAR : nextSelected ? ImageType.NEXT_ACTIVE_NO_TOOLBAR : ImageType.INACTIVE_NO_TOOLBAR;
}
}
if (cached == null) {
cached = new HashMap<ImageType, BufferedImage>();
myCache.put(item, cached);
}
BufferedImage image = cached.get(type);
if (image == null) {
image = drawToBuffer(item, floating, toolbarVisible, selected, navbar);
cached.put(type, image);
}
UIUtil.drawImage(g, image, 0, 0, null);
Icon icon = item.getIcon();
final int offset = item.isFirstElement() ? getFirstElementLeftOffset() : 0;
final int iconOffset = getElementPadding().left + offset;
icon.paintIcon(item, g, iconOffset, (item.getHeight() - icon.getIconHeight()) / 2);
final int textOffset = icon.getIconWidth() + getElementPadding().width() + offset;
item.doPaintText(g, textOffset);
}