Java 类com.intellij.util.ui.CenteredIcon 实例源码

项目:intellij-ce-playground    文件:InplaceButton.java   
public void setIcons(final Icon regular, Icon inactive, Icon hovered) {
  if (regular == null) return;
  if (inactive == null) inactive = regular;
  if (hovered == null) hovered = regular;

  int width = Math.max(regular.getIconWidth(), inactive.getIconWidth());
  width = Math.max(width, hovered.getIconWidth());
  int height = Math.max(regular.getIconHeight(), inactive.getIconHeight());
  height = Math.max(height, hovered.getIconHeight());


  setPreferredSize(new Dimension(width, height));

  myRegular = new CenteredIcon(regular, width, height);
  myHovered = new CenteredIcon(hovered, width, height);
  myInactive = new CenteredIcon(inactive, width, height);
}
项目:consulo    文件:InplaceButton.java   
public void setIcons(final Icon regular, Icon inactive, Icon hovered) {
  if (regular == null) return;
  if (inactive == null) inactive = regular;
  if (hovered == null) hovered = regular;

  int width = Math.max(regular.getIconWidth(), inactive.getIconWidth());
  width = Math.max(width, hovered.getIconWidth());
  int height = Math.max(regular.getIconHeight(), inactive.getIconHeight());
  height = Math.max(height, hovered.getIconHeight());


  setPreferredSize(new Dimension(width, height));

  myRegular = new CenteredIcon(regular, width, height);
  myHovered = new CenteredIcon(hovered, width, height);
  myInactive = new CenteredIcon(inactive, width, height);
}
项目:material-theme-jetbrains    文件:MTTreeUI.java   
private Icon getTreeNodeIcon(final boolean expanded, final boolean selected, final boolean focused) {
  final boolean white = selected && focused;

  final Icon selectedIcon = getTreeSelectedExpandedIcon();
  final Icon notSelectedIcon = getTreeExpandedIcon();

  final int width = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth());
  final int height = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth());

  return new CenteredIcon(expanded ? (white ? getTreeSelectedExpandedIcon() : getTreeExpandedIcon())
                                   : (white ? getTreeSelectedCollapsedIcon() : getTreeCollapsedIcon()),
      width, height, false);
}
项目:tools-idea    文件:InplaceButton.java   
public void setIcons(final Icon regular, final Icon inactive, final Icon hovered) {
  int width = Math.max(regular.getIconWidth(), inactive.getIconWidth());
  width = Math.max(width, hovered.getIconWidth());
  int height = Math.max(regular.getIconHeight(), inactive.getIconHeight());
  height = Math.max(height, hovered.getIconHeight());


  setPreferredSize(new Dimension(width, height));

  myRegular = new CenteredIcon(regular, width, height);
  myHovered = new CenteredIcon(hovered, width, height);
  myInactive = new CenteredIcon(inactive, width, height);
}
项目:intellij-ce-playground    文件:CardActionsPanel.java   
private static Presentation wrapIcon(Presentation presentation) {
  Icon original = presentation.getIcon();
  CenteredIcon centered = new CenteredIcon(original != null ? original : DEFAULT_ICON, 40, 40, false);
  presentation.setIcon(centered);
  return presentation;
}
项目:tools-idea    文件:CardActionsPanel.java   
private static Presentation wrapIcon(Presentation presentation) {
  Icon original = presentation.getIcon();
  CenteredIcon centered = new CenteredIcon(original != null ? original : DEFAULT_ICON, 40, 40, false);
  presentation.setIcon(centered);
  return presentation;
}