• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EditorFontType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.editor.colors.EditorFontType的典型用法代码示例。如果您正苦于以下问题:Java EditorFontType类的具体用法?Java EditorFontType怎么用?Java EditorFontType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EditorFontType类属于com.intellij.openapi.editor.colors包,在下文中一共展示了EditorFontType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: update

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
private void update() {
  if (myMainText == null) {
    setText("");
  }
  else {
    setText("<html><head>" +
            UIUtil.getCssFontDeclaration(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN)) +
            "</head><body>" +
            myMainText +
            "<br/>" +
            "<br/>" +
            getBranchesText() +
            "</body></html>");
  }
  revalidate();
  repaint();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DetailsPanel.java


示例2: getLineHeight

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public int getLineHeight() {
  synchronized (myLock) {
    if (myLineHeight < 0) {
      EditorColorsScheme colorsScheme = myEditor.getColorsScheme();
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(colorsScheme.getFont(EditorFontType.PLAIN));
      int fontMetricsHeight = FontLayoutService.getInstance().getHeight(fm);
      myLineHeight = (int)(fontMetricsHeight * (myEditor.isOneLineMode() ? 1 : colorsScheme.getLineSpacing()));
      if (myLineHeight <= 0) {
        myLineHeight = fontMetricsHeight;
        if (myLineHeight <= 0) {
          myLineHeight = 12;
        }
      }
    }
    return myLineHeight;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EditorView.java


示例3: paintPlaceholderText

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
private boolean paintPlaceholderText(Graphics2D g) {
  CharSequence hintText = myEditor.getPlaceholder();
  EditorComponentImpl editorComponent = myEditor.getContentComponent();
  if (myDocument.getTextLength() > 0 || hintText == null || hintText.length() == 0 ||
      KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == editorComponent &&
      !myEditor.getShowPlaceholderWhenFocused()) {
    return false;
  }

  hintText = SwingUtilities.layoutCompoundLabel(g.getFontMetrics(), hintText.toString(), null, 0, 0, 0, 0,
                                                editorComponent.getBounds(), new Rectangle(), new Rectangle(), 0);
  g.setColor(myEditor.getFoldingModel().getPlaceholderAttributes().getForegroundColor());
  g.setFont(myEditor.getColorsScheme().getFont(EditorFontType.PLAIN));
  g.drawString(hintText.toString(), 0, myView.getAscent());
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:EditorPainter.java


示例4: initMetricsIfNeeded

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
private void initMetricsIfNeeded() {
  if (myPlainSpaceWidth >= 0) return;

  FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColorsScheme().getFont(EditorFontType.PLAIN));

  int width = FontLayoutService.getInstance().charWidth(fm, ' ');
  myPlainSpaceWidth = width > 0 ? width : 1;

  myCharHeight = FontLayoutService.getInstance().charWidth(fm, 'a');

  float verticalScalingFactor = getVerticalScalingFactor();

  int fontMetricsHeight = FontLayoutService.getInstance().getHeight(fm);
  myLineHeight = (int)Math.ceil(fontMetricsHeight * verticalScalingFactor);

  int descent = FontLayoutService.getInstance().getDescent(fm);
  myDescent = (int)Math.floor(descent * verticalScalingFactor);
  myTopOverhang = fontMetricsHeight - myLineHeight + myDescent - descent;
  myBottomOverhang = descent - myDescent;

  // assuming that bold italic 'W' gives a good approximation of font's widest character
  FontMetrics fmBI = myEditor.getContentComponent().getFontMetrics(myEditor.getColorsScheme().getFont(EditorFontType.BOLD_ITALIC));
  myMaxCharWidth = FontLayoutService.getInstance().charWidth(fmBI, 'W');
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:EditorView.java


示例5: LookupCellRenderer

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public LookupCellRenderer(LookupImpl lookup) {
  EditorColorsScheme scheme = lookup.getTopLevelEditor().getColorsScheme();
  myNormalFont = scheme.getFont(EditorFontType.PLAIN);
  myBoldFont = scheme.getFont(EditorFontType.BOLD);

  myLookup = lookup;
  myNameComponent = new MySimpleColoredComponent();
  myNameComponent.setIpad(JBUI.insetsLeft(2));
  myNameComponent.setMyBorder(null);

  myTailComponent = new MySimpleColoredComponent();
  myTailComponent.setIpad(JBUI.emptyInsets());
  myTailComponent.setBorder(JBUI.Borders.emptyRight(10));

  myTypeLabel = new MySimpleColoredComponent();
  myTypeLabel.setIpad(JBUI.emptyInsets());
  myTypeLabel.setBorder(JBUI.Borders.emptyRight(6));

  myPanel = new LookupPanel();
  myPanel.add(myNameComponent, BorderLayout.WEST);
  myPanel.add(myTailComponent, BorderLayout.CENTER);
  myPanel.add(myTypeLabel, BorderLayout.EAST);

  myNormalMetrics = myLookup.getTopLevelEditor().getComponent().getFontMetrics(myNormalFont);
  myBoldMetrics = myLookup.getTopLevelEditor().getComponent().getFontMetrics(myBoldFont);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:LookupCellRenderer.java


示例6: FragmentNumberGutterIconRenderer

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public FragmentNumberGutterIconRenderer(String presentation, final TextAttributesKey key, final Component component, EditorEx editor) {
  myPresentation = presentation;
  final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
  final Color color = globalScheme.getAttributes(key).getBackgroundColor();

  myIcon = new CaptionIcon(color, editor.getColorsScheme().getFont(EditorFontType.PLAIN),
                           presentation, component, CaptionIcon.Form.ROUNDED, false, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FragmentNumberGutterIconRenderer.java


示例7: getPlainSpaceWidth

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
int getPlainSpaceWidth() {
  if (myPlainSpaceWidth < 0) {
    FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColorsScheme().getFont(EditorFontType.PLAIN));
    int width = FontLayoutService.getInstance().charWidth(fm, ' ');
    myPlainSpaceWidth = width > 0 ? width : 1;
  }
  return myPlainSpaceWidth;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:EditorView.java


示例8: getCharHeight

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public int getCharHeight() {
  synchronized (myLock) {
    if (myCharHeight < 0) {
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColorsScheme().getFont(EditorFontType.PLAIN));
      myCharHeight = FontLayoutService.getInstance().charWidth(fm, 'a');
    }
    return myCharHeight;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:EditorView.java


示例9: getMaxCharWidth

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
int getMaxCharWidth() {
  synchronized (myLock) {
    if (myMaxCharWidth < 0) {
      // assuming that bold italic 'W' gives a good approximation of font's widest character
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColorsScheme().getFont(EditorFontType.BOLD_ITALIC));
      myMaxCharWidth = FontLayoutService.getInstance().charWidth(fm, 'W'); 
    }
    return myMaxCharWidth;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:EditorView.java


示例10: getDescent

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public int getDescent() {
  synchronized (myLock) {
    if (myDescent < 0) {
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColorsScheme().getFont(EditorFontType.PLAIN));
      myDescent = FontLayoutService.getInstance().getDescent(fm);
    }
    return myDescent;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:EditorView.java


示例11: createEditorTextFieldPresentation

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public static JComponent createEditorTextFieldPresentation(final Project project,
                                                           final FileType type,
                                                           final String text,
                                                           boolean selected,
                                                           boolean focused) {
  final JPanel panel = new JPanel(new BorderLayout());
  final EditorTextField field = new EditorTextField(text, project, type) {
    @Override
    protected boolean shouldHaveBorder() {
      return false;
    }
  };

  Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
  font = new Font(font.getFontName(), font.getStyle(), 12);
  field.setFont(font);
  field.addSettingsProvider(EditorSettingsProvider.NO_WHITESPACE);

  if (selected && focused) {
    panel.setBackground(UIUtil.getTableSelectionBackground());
    field.setAsRendererWithSelection(UIUtil.getTableSelectionBackground(), UIUtil.getTableSelectionForeground());
  } else {
    panel.setBackground(UIUtil.getTableBackground());
    if (selected) {
      panel.setBorder(new DottedBorder(UIUtil.getTableForeground()));
    }
  }
  panel.add(field, BorderLayout.WEST);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:JBListTable.java


示例12: LookupCellRenderer

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public LookupCellRenderer(LookupImpl lookup) {
  EditorColorsScheme scheme = lookup.getEditor().getColorsScheme();
  myNormalFont = scheme.getFont(EditorFontType.PLAIN);
  myBoldFont = scheme.getFont(EditorFontType.BOLD);

  myLookup = lookup;
  myNameComponent = new MySimpleColoredComponent();
  myNameComponent.setIpad(JBUI.insetsLeft(2));
  myNameComponent.setMyBorder(null);

  myTailComponent = new MySimpleColoredComponent();
  myTailComponent.setIpad(new Insets(0, 0, 0, 0));

  myTypeLabel = new MySimpleColoredComponent();
  myTypeLabel.setIpad(new Insets(0, 0, 0, 0));

  myPanel = new LookupPanel();
  myPanel.add(myNameComponent, BorderLayout.WEST);
  myPanel.add(myTailComponent, BorderLayout.CENTER);
  myTailComponent.setBorder(new EmptyBorder(0, 0, 0, AFTER_TAIL));

  myPanel.add(myTypeLabel, BorderLayout.EAST);
  myTypeLabel.setBorder(new EmptyBorder(0, 0, 0, AFTER_TYPE));

  myNormalMetrics = myLookup.getEditor().getComponent().getFontMetrics(myNormalFont);
  myBoldMetrics = myLookup.getEditor().getComponent().getFontMetrics(myBoldFont);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:LookupCellRenderer.java


示例13: actionPerformed

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
  if (editor == null) return;
  final String prefix = myTextField.getText().substring(0, myTextField.getCaretPosition());
  if (StringUtil.isEmpty(prefix)) return;

    final String[] array = calcWords(prefix, editor);
    if (array.length == 0) {
      return;
    }

    FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
    final JList list = new JBList(array) {
      @Override
      protected void paintComponent(final Graphics g) {
        GraphicsUtil.setupAntialiasing(g);
        super.paintComponent(g);
      }
    };
    list.setBackground(new JBColor(new Color(235, 244, 254), new Color(0x4C4F51)));
    list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN));

    Utils.showCompletionPopup(
      e.getInputEvent() instanceof MouseEvent ? myTextField: null,
      list, null, myTextField, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:VariantsCompletionAction.java


示例14: MyListCellRenderer

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public MyListCellRenderer() {
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
  myNameLabel = new JLabel();

  myPanel.add(myNameLabel, BorderLayout.WEST);
  myPanel.add(new JLabel("     "));
  myNSLabel = new JLabel();
  myPanel.add(myNSLabel, BorderLayout.EAST);

  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  Font font = scheme.getFont(EditorFontType.PLAIN);
  myNameLabel.setFont(font);
  myNSLabel.setFont(font);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GenerateXmlTagAction.java


示例15: updateCrumbs

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
private void updateCrumbs() {
  if (myComponent != null && myEditor != null && !myEditor.isDisposed()) {
    final Font editorFont = myEditor.getColorsScheme().getFont(EditorFontType.PLAIN);
    myComponent.setFont(editorFont.deriveFont(Font.PLAIN, editorFont.getSize2D()));
    updateCrumbs(myEditor.getCaretModel().getLogicalPosition());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:BreadcrumbsXmlWrapper.java


示例16: MyListCellRenderer

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public MyListCellRenderer() {
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
  myNameLabel = new JLabel();

  myPanel.add(myNameLabel, BorderLayout.WEST);
  myPanel.add(new JLabel("     "));
  myDescLabel = new JLabel();
  myPanel.add(myDescLabel, BorderLayout.EAST);

  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  Font font = scheme.getFont(EditorFontType.PLAIN);
  myNameLabel.setFont(font);
  myDescLabel.setFont(font);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AddGradleDslPluginActionHandler.java


示例17: LookupCellRenderer

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public LookupCellRenderer(LookupImpl lookup) {
  EditorColorsScheme scheme = lookup.getEditor().getColorsScheme();
  myNormalFont = scheme.getFont(EditorFontType.PLAIN);
  myBoldFont = scheme.getFont(EditorFontType.BOLD);

  myLookup = lookup;
  myNameComponent = new MySimpleColoredComponent();
  myNameComponent.setIpad(new Insets(0, 0, 0, 0));

  myTailComponent = new MySimpleColoredComponent();
  myTailComponent.setIpad(new Insets(0, 0, 0, 0));
  myTailComponent.setFont(myNormalFont);

  myTypeLabel = new MySimpleColoredComponent();
  myTypeLabel.setIpad(new Insets(0, 0, 0, 0));
  myTypeLabel.setFont(myNormalFont);

  myPanel = new LookupPanel();
  myPanel.add(myNameComponent, BorderLayout.WEST);
  myPanel.add(myTailComponent, BorderLayout.CENTER);
  myTailComponent.setBorder(new EmptyBorder(0, 0, 0, AFTER_TAIL));

  myPanel.add(myTypeLabel, BorderLayout.EAST);
  myTypeLabel.setBorder(new EmptyBorder(0, 0, 0, AFTER_TYPE));

  myNormalMetrics = myLookup.getEditor().getComponent().getFontMetrics(myNormalFont);
  myBoldMetrics = myLookup.getEditor().getComponent().getFontMetrics(myBoldFont);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:LookupCellRenderer.java


示例18: actionPerformed

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  final String prefix = getPrefix();
  if (StringUtil.isEmpty(prefix)) return;

  Editor editor = getEditorSearchComponent().getEditor();
  if (editor != null) {
    final String[] array = calcWords(prefix, editor);
    if (array.length == 0) {
      return;
    }

    FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
    final JList list = new JBList(array) {
      @Override
      protected void paintComponent(final Graphics g) {
        GraphicsUtil.setupAntialiasing(g);
        super.paintComponent(g);
      }
    };
    list.setBackground(EditorSearchComponent.COMPLETION_BACKGROUND_COLOR);
    list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN));

    Utils.showCompletionPopup(
      e.getInputEvent() instanceof MouseEvent ? getEditorSearchComponent().getToolbarComponent() : null,
      list, null, getTextField(), null);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:VariantsCompletionAction.java


示例19: updateCrumbs

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
private void updateCrumbs() {
  if (myComponent != null && myEditor != null) {
    final Font editorFont = myEditor.getColorsScheme().getFont(EditorFontType.PLAIN);
    myComponent.setFont(editorFont.deriveFont(Font.PLAIN, editorFont.getSize2D()));
    updateCrumbs(myEditor.getCaretModel().getLogicalPosition());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:BreadcrumbsXmlWrapper.java


示例20: createOptionsPanel

import com.intellij.openapi.editor.colors.EditorFontType; //导入依赖的package包/类
public JComponent createOptionsPanel() {
  myCopyrightPane.setFont(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));
  myValidateButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      try {
        VelocityHelper.verify(myCopyrightPane.getText());
        Messages.showInfoMessage(myProject, "Velocity template is valid.", "Validation");
      }
      catch (Exception e1) {
        Messages.showInfoMessage(myProject, "Velocity template contains error:\n" + e1.getMessage(), "Validation");
      }
    }
  });
  return myWholePanel;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:CopyrightConfigurable.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Camera2Enumerator类代码示例发布时间:2022-05-22
下一篇:
Java PointVectorStrategy类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap