当前位置: 首页>>代码示例>>Java>>正文


Java SimpleColoredComponent.setIpad方法代码示例

本文整理汇总了Java中com.intellij.ui.SimpleColoredComponent.setIpad方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleColoredComponent.setIpad方法的具体用法?Java SimpleColoredComponent.setIpad怎么用?Java SimpleColoredComponent.setIpad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.SimpleColoredComponent的用法示例。


在下文中一共展示了SimpleColoredComponent.setIpad方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendGroupText

import com.intellij.ui.SimpleColoredComponent; //导入方法依赖的package包/类
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
  UsageGroup group = node == null ? null : node.getGroup();
  if (group == null) return;
  GroupNode parentGroup = (GroupNode)node.getParent();
  appendGroupText(parentGroup, panel, fileBgColor);
  if (node.canNavigateToSource()) {
    SimpleColoredComponent renderer = new SimpleColoredComponent();

    renderer.setIcon(group.getIcon(false));
    SimpleTextAttributes attributes = deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
    renderer.append(group.getText(myUsageView), attributes);
    renderer.append(" ", attributes);
    renderer.setIpad(new Insets(0,0,0,0));
    renderer.setBorder(null);
    panel.add(renderer);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ShowUsagesTableCellRenderer.java

示例2: createNorthPanel

import com.intellij.ui.SimpleColoredComponent; //导入方法依赖的package包/类
@Override
protected JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());
  GridBagConstraints gbConstraints = new GridBagConstraints();

  gbConstraints.insets = new Insets(0, 0, UIUtil.DEFAULT_VGAP, 0);
  gbConstraints.fill = GridBagConstraints.NONE;
  gbConstraints.weightx = 1;
  gbConstraints.weighty = 1;
  gbConstraints.anchor = GridBagConstraints.WEST;
  final SimpleColoredComponent coloredComponent = new SimpleColoredComponent();
  coloredComponent.setIpad(new Insets(0,0,0,0));
  coloredComponent.setMyBorder(null);
  configureLabelComponent(coloredComponent);
  panel.add(coloredComponent, gbConstraints);

  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AbstractFindUsagesDialog.java

示例3: appendGroupText

import com.intellij.ui.SimpleColoredComponent; //导入方法依赖的package包/类
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
  UsageGroup group = node == null ? null : node.getGroup();
  if (group == null) return;
  GroupNode parentGroup = (GroupNode) node.getParent();
  appendGroupText(parentGroup, panel, fileBgColor);
  if (node.canNavigateToSource()) {
    SimpleColoredComponent renderer = new SimpleColoredComponent();

    renderer.setIcon(group.getIcon(false));
    SimpleTextAttributes attributes =
        deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
    renderer.append(group.getText(myUsageView), attributes);
    renderer.append(" ", attributes);
    renderer.setIpad(new Insets(0, 0, 0, 0));
    renderer.setBorder(null);
    panel.add(renderer);
  }
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:19,代码来源:ShowUsagesTableCellRenderer.java

示例4: textComponentSpanningWholeRow

import com.intellij.ui.SimpleColoredComponent; //导入方法依赖的package包/类
@NotNull
private static Component textComponentSpanningWholeRow(@NotNull SimpleColoredComponent chunks,
                                                       Color panelBackground,
                                                       Color panelForeground,
                                                       final int column,
                                                       @NotNull final JTable table, int row) {
  final SimpleColoredComponent component = new SimpleColoredComponent() {
    @Override
    protected void doPaint(Graphics2D g) {
      int offset = 0;
      int i = 0;
      final TableColumnModel columnModel = table.getColumnModel();
      while (i < column) {
        offset += columnModel.getColumn(i).getWidth();
        i++;
      }
      g.translate(-offset, 0);

      //if (column == columnModel.getColumnCount()-1) {
      //}
      setSize(getWidth()+offset, getHeight()); // should increase the column width so that selection background will be visible even after offset translation

      super.doPaint(g);

      g.translate(+offset, 0);
    }

    @NotNull
    @Override
    public Dimension getPreferredSize() {
      //return super.getPreferredSize();
      return column == table.getColumnModel().getColumnCount()-1 ? super.getPreferredSize() : new Dimension(0,0);
      // it should span the whole row, so we can't return any specific value here,
      // because otherwise it would be used in the "max width" calculation in com.intellij.find.actions.ShowUsagesAction.calcMaxWidth
    }
  };

  component.setIpad(new Insets(0,0,0,0));
  component.setBorder(null);
  component.setBackground(panelBackground);
  component.setForeground(panelForeground);

  for (SimpleColoredComponent.ColoredIterator iterator = chunks.iterator(); iterator.hasNext(); ) {
    iterator.next();
    String fragment = iterator.getFragment();
    SimpleTextAttributes attributes = iterator.getTextAttributes();
    attributes = attributes.derive(attributes.getStyle(), panelForeground, panelBackground, attributes.getWaveColor());
    component.append(fragment, attributes);
  }

  return component;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:53,代码来源:ShowUsagesTableCellRenderer.java

示例5: createLabel

import com.intellij.ui.SimpleColoredComponent; //导入方法依赖的package包/类
private SimpleColoredComponent createLabel(final JBTabsImpl tabs) {
    SimpleColoredComponent label = new SimpleColoredComponent() {
        @Override
        protected boolean shouldDrawMacShadow() {
            return SystemInfo.isMac || com.intellij.util.ui.DrawUtil.isUnderDarcula();
        }

        @Override
        protected boolean shouldDrawDimmed() {
            return myTabs.getSelectedInfo() != myInfo || myTabs.useBoldLabels();
        }

        @Override
        public Font getFont() {
            if (isFontSet() || !myTabs.useSmallLabels()) {
                return super.getFont();
            }
            return UIUtil.getLabelFont(UIUtil.FontSize.SMALL);
        }

        @Override
        protected void doPaint(Graphics2D g) {
            Rectangle clip = getVisibleRect();
            if (getPreferredSize().width <= clip.width + 2) {
                super.doPaint(g);
                return;
            }
            int dimSize = 10;
            int dimStep = 2;
            Composite oldComposite = g.getComposite();
            Shape oldClip = g.getClip();
            try {
                g.setClip(clip.x, clip.y, Math.max(0, clip.width - dimSize), clip.height);
                super.doPaint(g);

                for (int x = clip.x + clip.width - dimSize; x < clip.x + clip.width; x += dimStep) {
                    g.setClip(x, clip.y, dimStep, clip.height);
                    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1 - ((float) x - (clip.x + clip.width - dimSize)) / dimSize));
                    super.doPaint(g);
                }
            } finally {
                g.setComposite(oldComposite);
                g.setClip(oldClip);
            }
        }
    };
    label.setOpaque(false);
    label.setBorder(null);
    label.setIconTextGap(tabs.isEditorTabs() ? 2 : new JLabel().getIconTextGap());
    label.setIconOpaque(false);
    label.setIpad(new Insets(0, 0, 0, 0));

    return label;
}
 
开发者ID:JetBrains,项目名称:jediterm,代码行数:55,代码来源:TabLabel.java

示例6: textComponentSpanningWholeRow

import com.intellij.ui.SimpleColoredComponent; //导入方法依赖的package包/类
@Nonnull
private static Component textComponentSpanningWholeRow(@Nonnull SimpleColoredComponent chunks,
                                                       Color panelBackground,
                                                       Color panelForeground,
                                                       final int column,
                                                       @Nonnull final JTable table, int row) {
  final SimpleColoredComponent component = new SimpleColoredComponent() {
    @Override
    protected void doPaint(Graphics2D g) {
      int offset = 0;
      int i = 0;
      final TableColumnModel columnModel = table.getColumnModel();
      while (i < column) {
        offset += columnModel.getColumn(i).getWidth();
        i++;
      }
      g.translate(-offset, 0);

      //if (column == columnModel.getColumnCount()-1) {
      //}
      setSize(getWidth()+offset, getHeight()); // should increase the column width so that selection background will be visible even after offset translation

      super.doPaint(g);

      g.translate(+offset, 0);
    }

    @Nonnull
    @Override
    public Dimension getPreferredSize() {
      //return super.getPreferredSize();
      return column == table.getColumnModel().getColumnCount()-1 ? super.getPreferredSize() : new Dimension(0,0);
      // it should span the whole row, so we can't return any specific value here,
      // because otherwise it would be used in the "max width" calculation in com.intellij.find.actions.ShowUsagesAction.calcMaxWidth
    }
  };

  component.setIpad(new Insets(0,0,0,0));
  component.setBorder(null);
  component.setBackground(panelBackground);
  component.setForeground(panelForeground);

  for (SimpleColoredComponent.ColoredIterator iterator = chunks.iterator(); iterator.hasNext(); ) {
    iterator.next();
    String fragment = iterator.getFragment();
    SimpleTextAttributes attributes = iterator.getTextAttributes();
    attributes = attributes.derive(attributes.getStyle(), panelForeground, panelBackground, attributes.getWaveColor());
    component.append(fragment, attributes);
  }

  return component;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:53,代码来源:ShowUsagesTableCellRenderer.java


注:本文中的com.intellij.ui.SimpleColoredComponent.setIpad方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。