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

Java DarculaUIUtil类代码示例

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

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



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

示例1: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g2, int x, int y, int width, int height) {
  if (DarculaTextFieldUI.isSearchField(c)) return;
  Graphics2D g = (Graphics2D)g2;
  final GraphicsConfig config = new GraphicsConfig(g);
  g.translate(x, y);

  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, 2, 2, width - 4, height - 4);
  }
  else {
    boolean editable = !(c instanceof JTextComponent) || ((JTextComponent)c).isEditable();
    g.setColor(getBorderColor(c.isEnabled() && editable));
    g.drawRect(1, 1, width - 2, height - 2);
  }
  g.translate(-x, -y);
  config.restore();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DarculaTextBorder.java


示例2: paintFocusRing

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
/**
 * Executing the DarculaUIUtil.paintFocusRing() method independent of the IDEA version we are on
 *
 * @param g
 * @param x
 * @param y
 * @param width
 * @param height
 */
public static void paintFocusRing(final Graphics g, final int x, final int y, final int width, final int height) {
    try {
        // trying to paint focus using the IDEA 2017 method
        final Method paintFocusRingMethodNew = DarculaUIUtil.class.getDeclaredMethod("paintFocusRing", Graphics.class, Rectangle.class);
        paintFocusRingMethodNew.invoke(null, g, new Rectangle(x, y, width, height));
    } catch (Exception newImplementationException) {
        try {
            logger.warn("Failed to get DarculaUIUtil.paintFocusRing() new implementation so attempting old way", newImplementationException);
            final Method paintFocusRingMethodOld = DarculaUIUtil.class.getDeclaredMethod("paintFocusRing", Graphics.class,
                    Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE);
            paintFocusRingMethodOld.invoke(null, g, x, y, width, height);
        } catch (Exception oldImplementationException) {
            logger.warn("Failed to find DarculaUIUtil.paintFocusRing() method", oldImplementationException);
        }
    }
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:26,代码来源:BackCompatibleUtils.java


示例3: patchPanels

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
static void patchPanels() throws Exception {
  if (MTConfig.getInstance().isMaterialTheme()) {
    final Color color = UIManager.getColor("Panel.background");
    StaticPatcher.setFinalStatic(UIUtil.class, "CONTRAST_BORDER_COLOR", ColorUtil.withAlpha(color, .05));
    StaticPatcher.setFinalStatic(UIUtil.class, "BORDER_COLOR", color);
    StaticPatcher.setFinalStatic(UIUtil.class, "AQUA_SEPARATOR_FOREGROUND_COLOR", color);
    //        StaticPatcher.setFinalStatic(HelpTooltip.class, "BACKGROUND_COLOR", color);
  }

  final Field[] fields = DarculaUIUtil.class.getDeclaredFields();
  final Object[] objects = Arrays.stream(fields)
                                 .filter(f -> f.getType().equals(Color.class))
                                 .toArray();
  final Color accentColor = ColorUtil.fromHex(MTConfig.getInstance().getAccentColor());
  final JBColor accentJBColor = new JBColor(accentColor, accentColor);
  StaticPatcher.setFinalStatic((Field) objects[0], accentJBColor);
  //      StaticPatcher.setFinalStatic((Field) objects[1], accentJBColor);

  final Field[] fields2 = IdeaActionButtonLook.class.getDeclaredFields();
  final Object[] objects2 = Arrays.stream(fields2)
                                  .filter(f -> f.getType().equals(Color.class))
                                  .toArray();

  StaticPatcher.setFinalStatic((Field) objects2[1], accentJBColor);
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:26,代码来源:UIReplacer.java


示例4: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
  final Graphics2D g2 = (Graphics2D) g.create();
  try {
    g2.translate(x, y);

    final Object eop = ((JComponent) c).getClientProperty("JComponent.outline");
    if (Registry.is("ide.inplace.errors.outline") && Boolean.parseBoolean(String.valueOf(eop))) {
      DarculaUIUtil.paintOutlineBorder(g2, width, height, 0, true, c.hasFocus(), DarculaUIUtil.Outline.valueOf(eop.toString()));
    } else if (c.hasFocus()) {
      g2.setColor(getSelectedBorderColor());
      g2.fillRect(JBUI.scale(1), height - JBUI.scale(2), width - JBUI.scale(2), JBUI.scale(2));
    } else if (!c.isEnabled()) {
      g.setColor(getBorderColor(c.isEnabled()));
      g2.setStroke(new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, new float[]{1,
          2}, 0));
      g2.draw(new Rectangle2D.Double(JBUI.scale(1), height - JBUI.scale(1), width - JBUI.scale(2), JBUI.scale(2)));
    } else {
      final boolean editable = !(c instanceof JTextComponent) || ((JTextComponent) c).isEditable();
      g2.setColor(getBorderColor(editable));
      g2.fillRect(JBUI.scale(1), height - JBUI.scale(1), width - JBUI.scale(2), JBUI.scale(2));
    }
  } finally {
    g2.dispose();
  }
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:27,代码来源:MTTextBorder.java


示例5: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final Graphics2D g2d = (Graphics2D)g;
  final Insets ins = getBorderInsets(c);
  final int yOff = (ins.top + ins.bottom) / 4;
  int offset = getOffset();
  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g2d, offset, yOff, width - 2 * offset, height - 2 * yOff);
  } else {
    final GraphicsConfig config = new GraphicsConfig(g);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
    g2d.setPaint(
      UIUtil.getGradientPaint(width / 2, y + yOff + 1, Gray._80.withAlpha(90), width / 2, height - 2 * yOff, Gray._90.withAlpha(90)));
    //g.drawRoundRect(x + offset + 1, y + yOff + 1, width - 2 * offset, height - 2*yOff, 5, 5);

    ((Graphics2D)g).setPaint(Gray._100.withAlpha(180));
    g.drawRoundRect(x + offset, y + yOff, width - 2 * offset, height - 2*yOff, 5, 5);

    config.restore();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:DarculaButtonPainter.java


示例6: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g2, int x, int y, int width, int height) {
  if (DarculaTextFieldUI.isSearchField(c)) return;
  Graphics2D g = ((Graphics2D)g2);
  final GraphicsConfig config = new GraphicsConfig(g);
  g.translate(x, y);

  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, 2, 2, width-4, height-4);
  } else {
    boolean editable = !(c instanceof JTextComponent) || (((JTextComponent)c).isEditable());
    g.setColor(c.isEnabled() && editable ? Gray._100 : new Color(0x535353));
    g.drawRect(1, 1, width - 2, height - 2);
  }
  g.translate(-x, -y);
  config.restore();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:DarculaTextBorder.java


示例7: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g2, int x, int y, int width, int height) {
  if (DarculaTextFieldUI.isSearchField(c)) return;
  Graphics2D g = ((Graphics2D)g2);
  final GraphicsConfig config = new GraphicsConfig(g);
  g.translate(x, y);

  if (c.hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, new Rectangle(JBUI.scale(2), JBUI.scale(2), width - JBUI.scale(4), height - JBUI.scale(4)));
  }
  else {
    boolean editable = !(c instanceof JTextComponent) || (((JTextComponent)c).isEditable());
    g.setColor(c.isEnabled() && editable ? Gray._100 : new Color(0x535353));
    g.drawRect(JBUI.scale(1), JBUI.scale(1), width - JBUI.scale(2), height - JBUI.scale(2));
  }
  g.translate(-x, -y);
  config.restore();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:DarculaTextBorder.java


示例8: paint

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
void paint(Graphics2D g) {
  Rectangle r = new Rectangle(getSize());
  JBInsets.removeFrom(r, getInsets());
  if (r.height % 2 == 1) r.height++;
  int arcSize = JBUI.scale(26);

  JBInsets.removeFrom(r, new JBInsets(1, 1, 1, 1));
  if (myTextArea.hasFocus()) {
    g.setColor(myTextArea.getBackground());
    RectanglePainter.FILL.paint(g, r.x, r.y, r.width, r.height, arcSize);
    DarculaUIUtil.paintSearchFocusRing(g, r, myTextArea, arcSize);
  }
  else {
    arcSize -= JBUI.scale(5);
    RectanglePainter
            .paint(g, r.x, r.y, r.width, r.height, arcSize, myTextArea.getBackground(), myTextArea.isEnabled() ? Gray._100 : Gray._83);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:SearchTextArea.java


示例9: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final Graphics2D g2d = (Graphics2D)g;
  final Insets ins = getBorderInsets(c);
  final int yOff = (ins.top + ins.bottom) / 4;
  final boolean square = DarculaButtonUI.isSquare(c);
  int offset = JBUI.scale(square ? 1 : getOffset());
  int w = c.getWidth();
  int h = c.getHeight();
  int diam = JBUI.scale(22);

  if (c.hasFocus()) {
    if (DarculaButtonUI.isHelpButton((JComponent)c)) {
        DarculaUIUtil.paintFocusOval(g2d, (w - diam) / 2, (h - diam) / 2, diam, diam);
    } else {
      DarculaUIUtil.paintFocusRing(g2d, offset, yOff, width - 2 * offset, height - 2 * yOff);
    }
  } else {
    final GraphicsConfig config = new GraphicsConfig(g);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
    g2d.setPaint(UIUtil.getGradientPaint(width / 2, y + yOff + JBUI.scale(1), Gray._80.withAlpha(90), width / 2, height - 2 * yOff, Gray._90.withAlpha(90)));
    //g.drawRoundRect(x + offset + 1, y + yOff + 1, width - 2 * offset, height - 2*yOff, 5, 5);
    ((Graphics2D)g).setPaint(Gray._100.withAlpha(180));
    if (DarculaButtonUI.isHelpButton((JComponent)c)) {
      g.drawOval((w - diam) / 2, (h - diam) / 2, diam, diam);
    } else {
      g.translate(x,y);
      int r = JBUI.scale(square ? 3 : 5);
      g.drawRoundRect(offset, yOff, width - 2 * offset, height - 2 * yOff, r, r);
      g.translate(-x,-y);
    }

    config.restore();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:DarculaButtonPainter.java


示例10: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  if (isComboBoxEditor(c) /*|| isCellEditor(c)*/) {
    g.setColor(c.getBackground());
    g.fillRect(x, y, width, height);
    return;
  }
  final EditorTextField textField = UIUtil.getParentOfType(EditorTextField.class, c);
  if (textField == null) return;

  final Rectangle r = new Rectangle(x + 1, y + 1, width - 2, height - 2);

  if (c.isOpaque()) {
    g.setColor(UIUtil.getPanelBackground());
    g.fillRect(x, y, width, height);
  }

  g.setColor(c.getBackground());
  g.fillRect(r.x, r.y, r.width, r.height);

  if (!textField.isEnabled()) {
    ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
  }

  if (textField.isEnabled() && textField.isVisible() && textField.getFocusTarget().hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, r.x + 1, r.y + 1, r.width - 2, r.height - 2);
  } else {
    g.setColor(new JBColor(Gray._150, Gray._100));
    g.drawRect(r.x, r.y, r.width, r.height);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:DarculaEditorTextFieldBorder.java


示例11: paintSearchField

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
protected void paintSearchField(Graphics2D g, JTextComponent c, Rectangle r) {
  g.setColor(c.getBackground());
  final boolean noBorder = c.getClientProperty("JTextField.Search.noBorderRing") == Boolean.TRUE;
  int radius = r.height-1;
  g.fillRoundRect(r.x, r.y+1, r.width, r.height - (noBorder ? 2 : 1), radius, radius);
  g.setColor(c.isEnabled() ? Gray._100 : Gray._83);
  if (!noBorder) {
    if (c.hasFocus()) {
        DarculaUIUtil.paintSearchFocusRing(g, r);
    } else {
      g.drawRoundRect(r.x, r.y, r.width, r.height-1, radius, radius);
    }
  }
  Point p = getSearchIconCoord();
  Icon searchIcon = myTextField.getClientProperty("JTextField.Search.FindPopup") instanceof JPopupMenu ? UIManager.getIcon("TextField.darcula.searchWithHistory.icon") : UIManager.getIcon("TextField.darcula.search.icon");
  if (searchIcon == null) {
    searchIcon = IconLoader.findIcon("/com/intellij/ide/ui/laf/icons/search.png", DarculaTextFieldUI.class, true);
  }
  searchIcon.paintIcon(null, g, p.x, p.y);
  if (hasText()) {
    p = getClearIconCoord();
    Icon clearIcon = UIManager.getIcon("TextField.darcula.clear.icon");
    if (clearIcon == null) {
      clearIcon = IconLoader.findIcon("/com/intellij/ide/ui/laf/icons/clear.png", DarculaTextFieldUI.class, true);
    }
    clearIcon.paintIcon(null, g, p.x, p.y);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:DarculaTextFieldUI.java


示例12: paint

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paint(Graphics graphics) {
  Graphics2D g = (Graphics2D)graphics.create();
  try {
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
    Rectangle r = new Rectangle(getSize());
    r.x += JBUI.scale(4);
    r.y += JBUI.scale(3);
    r.width -= JBUI.scale(9);
    r.height -= JBUI.scale(6);
    int arcSize = Math.min(25, r.height - 1) - 6;
    g.setColor(myTextArea.getBackground());
    boolean hasFocus = myTextArea.hasFocus();
    g.fillRoundRect(r.x, r.y + 1, r.width, r.height - 2, arcSize, arcSize);
    g.setColor(myTextArea.isEnabled() ? Gray._100 : Gray._83);

    if (hasFocus) {
      DarculaUIUtil.paintSearchFocusRing(g, r, arcSize + 6);
    }
    else {
      g.drawRoundRect(r.x, r.y, r.width, r.height - 1, arcSize, arcSize);
    }
  }
  finally {
    g.dispose();
  }
  super.paint(graphics);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:SearchTextArea.java


示例13: paint

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paint(Graphics graphics) {
  super.paint(graphics);
  if ((textField.isFocusOwner() || (getPopup() != null && getPopup().isPopupVisible()))) {
    if (isUsingDarculaUiFlavor()) {
      DarculaUIUtil.paintFocusRing(
          graphics, new Rectangle(3, 3, getWidth() - 4, getHeight() - 4));
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:11,代码来源:CustomizableComboBox.java


示例14: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final EditorTextField textField = UIUtil.getParentOfType(EditorTextField.class, c);
  if (textField == null) return;

  final int x1 = x + 3;
  final int y1 = y + 3;
  final int width1 = width - 8;
  final int height1 = height - 6;

  if (c.isOpaque()) {
    g.setColor(UIUtil.getPanelBackground());
    g.fillRect(x, y, width, height);
  }

  g.setColor(c.getBackground());
  g.fillRect(x1, y1, width1, height1);

  if (!textField.isEnabled()) {
    ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
  }

  if (textField.isEnabled() && textField.isVisible() && textField.getFocusTarget().hasFocus()) {
    DarculaUIUtil.paintFocusRing((Graphics2D)g, x1, y1, width1, height1);
  } else {
    g.setColor(Gray._100);
    g.drawRect(x1, y1, width1, height1);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:DarculaEditorTextFieldBorder.java


示例15: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final JSpinner spinner = (JSpinner)c;
  final JFormattedTextField editor = UIUtil.findComponentOfType(spinner, JFormattedTextField.class);
  final int x1 = x + 3;
  final int y1 = y + 3;
  final int width1 = width - 8;
  final int height1 = height - 6;
  final boolean focused = c.isEnabled() && c.isVisible() && editor != null && editor.hasFocus();
  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);

  if (c.isOpaque()) {
    g.setColor(UIUtil.getPanelBackground());
    g.fillRect(x, y, width, height);
  }

  g.setColor(UIUtil.getTextFieldBackground());
  g.fillRoundRect(x1, y1, width1, height1, 5, 5);
  g.setColor(UIUtil.getPanelBackground());
  if (editor != null) {
    final int off = editor.getBounds().x + editor.getWidth() + ((JSpinner)c).getInsets().left + 1;
    g.fillRect(off, y1, 17, height1);
    g.setColor(Gray._100);
    g.drawLine(off, y1, off, height1+2);
  }

  if (!c.isEnabled()) {
    ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
  }

  if (focused) {
    DarculaUIUtil.paintFocusRing(g, x1, y1, width1, height1);
  } else {
    g.setColor(Gray._100);
    g.drawRoundRect(x1, y1, width1, height1, 5, 5);
  }
  config.restore();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:39,代码来源:DarculaSpinnerBorder.java


示例16: paint

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
public void paint(Component c, Graphics2D g2, int width, int height, int arc) {
  clipForBorder(c, g2, width, height);

  Object eop = ((JComponent)c).getClientProperty("JComponent.error.outline");
  if (Registry.is("ide.inplace.errors.outline") && Boolean.parseBoolean(String.valueOf(eop))) {
    DarculaUIUtil.paintErrorBorder(g2, width, height, arc, isSymmetric(), isFocused(c));
  } else if (isFocused(c)) {
    DarculaUIUtil.paintFocusBorder(g2, width, height, arc, isSymmetric());
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:MacIntelliJTextBorder.java


示例17: paintAquaSearchFocusRing

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
public static void paintAquaSearchFocusRing(Graphics2D g, Rectangle r, Component c) {
  Graphics2D g2 = (Graphics2D)g.create();
  try {
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
    g2.translate(r.x, r.y);

    int arc = JBUI.scale(6);
    double lw = UIUtil.isRetina(g2) ? 0.5 : 1.0;
    Shape outerShape = new RoundRectangle2D.Double(JBUI.scale(3), JBUI.scale(3),
                                                   r.width - JBUI.scale(6),
                                                   r.height - JBUI.scale(6),
                                                   arc, arc);
    g2.setColor(c.getBackground());
    g2.fill(outerShape);

    Path2D path = new Path2D.Double(Path2D.WIND_EVEN_ODD);
    path.append(outerShape, false);
    path.append(new RoundRectangle2D.Double(JBUI.scale(3) + lw, JBUI.scale(3) + lw,
                                            r.width - JBUI.scale(6) - lw*2,
                                            r.height - JBUI.scale(6) - lw*2,
                                            arc-lw, arc-lw), false);

    g2.setColor(Gray.xBC);
    g2.fill(path);

    if (c.hasFocus()) {
      DarculaUIUtil.paintFocusBorder(g2, r.width, r.height, arc, true);
    }
  }
  finally {
    g2.dispose();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:35,代码来源:MacIntelliJTextFieldUI.java


示例18: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final Graphics2D g2d = (Graphics2D)g;
  final Insets ins = getBorderInsets(c);
  final int yOff = (ins.top + ins.bottom) / 4;
  final boolean square = DarculaButtonUI.isSquare(c);
  int offset = JBUI.scale(square ? 1 : getOffset());
  int w = c.getWidth();
  int h = c.getHeight();
  int diam = JBUI.scale(22);

  if (c.hasFocus()) {
    if (DarculaButtonUI.isHelpButton((JComponent)c)) {
      DarculaUIUtil.paintFocusOval(g2d, (w - diam) / 2, (h - diam) / 2, diam, diam);
    } else {
      DarculaUIUtil.paintFocusRing(g2d, new Rectangle(offset, yOff, width - 2 * offset, height - 2 * yOff));
    }
  } else {
    final GraphicsConfig config = new GraphicsConfig(g);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
    g2d.setPaint(UIUtil.getGradientPaint(width / 2, y + yOff + JBUI.scale(1), Gray._80.withAlpha(90), width / 2, height - 2 * yOff, Gray._90.withAlpha(90)));
    //g.drawRoundRect(x + offset + 1, y + yOff + 1, width - 2 * offset, height - 2*yOff, 5, 5);
    ((Graphics2D)g).setPaint(getBorderColor());
    if (DarculaButtonUI.isHelpButton((JComponent)c)) {
      g.drawOval((w - diam) / 2, (h - diam) / 2, diam, diam);
    } else {
      g.translate(x,y);
      int r = JBUI.scale(square ? 3 : 5);
      g.drawRoundRect(offset, yOff, width - 2 * offset, height - 2 * yOff, r, r);
      g.translate(-x,-y);
    }

    config.restore();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:DarculaButtonPainter.java


示例19: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final EditorTextField textField = UIUtil.getParentOfType(EditorTextField.class, c);
  if (textField == null) return;

  final int x1 = x + JBUI.scale(3);
  final int y1 = y + JBUI.scale(3);
  final int width1 = width - JBUI.scale(8);
  final int height1 = height - JBUI.scale(6);

  if (c.isOpaque()) {
    g.setColor(UIUtil.getPanelBackground());
    g.fillRect(x, y, width, height);
  }

  g.setColor(c.getBackground());
  g.fillRect(x1, y1, width1, height1);

  if (!textField.isEnabled()) {
    ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
  }

  if (textField.isEnabled() && textField.isVisible() && textField.getFocusTarget().hasFocus()) {
    DarculaUIUtil.paintFocusRing(g, new Rectangle(x1, y1, width1, height1));
  }
  else {
    g.setColor(new JBColor(Gray._150, Gray._100));
    g.drawRect(x1, y1, width1, height1);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:31,代码来源:DarculaEditorTextFieldBorder.java


示例20: paintBorder

import com.intellij.ide.ui.laf.darcula.DarculaUIUtil; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  final JSpinner spinner = (JSpinner)c;
  final JFormattedTextField editor = UIUtil.findComponentOfType(spinner, JFormattedTextField.class);
  final int x1 = x + JBUI.scale(3);
  final int y1 = y + JBUI.scale(3);
  final int width1 = width - JBUI.scale(8);
  final int height1 = height - JBUI.scale(6);
  final boolean focused = c.isEnabled() && c.isVisible() && editor != null && editor.hasFocus();
  final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);

  if (c.isOpaque()) {
    g.setColor(UIUtil.getPanelBackground());
    g.fillRect(x, y, width, height);
  }

  g.setColor(UIUtil.getTextFieldBackground());
  g.fillRoundRect(x1, y1, width1, height1, JBUI.scale(5), JBUI.scale(5));
  g.setColor(UIUtil.getPanelBackground());
  if (editor != null) {
    final int off = editor.getBounds().x + editor.getWidth() + ((JSpinner)c).getInsets().left + JBUI.scale(1);
    g.fillRect(off, y1, JBUI.scale(17), height1);
    g.setColor(Gray._100);
    g.drawLine(off, y1, off, height1 + JBUI.scale(2));
  }

  if (!c.isEnabled()) {
    ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
  }

  if (focused) {
    DarculaUIUtil.paintFocusRing(g, new Rectangle(x1, y1, width1, height1));
  }
  else {
    g.setColor(Gray._100);
    g.drawRoundRect(x1, y1, width1, height1, JBUI.scale(5), JBUI.scale(5));
  }
  config.restore();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:40,代码来源:DarculaSpinnerBorder.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ToolbarModelSecurityLevel类代码示例发布时间:2022-05-22
下一篇:
Java ClassRequest类代码示例发布时间: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