Java 类com.intellij.ui.Gray 实例源码

项目:intellij-ce-playground    文件:CompilerUIConfigurable.java   
public CompilerUIConfigurable(@NotNull final Project project) {
  myProject = project;

  myPatternLegendLabel.setText(XmlStringUtil.wrapInHtml(
                                 "Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern. " +
                                 "Accepted wildcards: <b>?</b> &mdash; exactly one symbol; <b>*</b> &mdash; zero or more symbols; " +
                                 "<b>/</b> &mdash; path separator; <b>/**/</b> &mdash; any number of directories; " +
                                 "<i>&lt;dir_name&gt;</i>:<i>&lt;pattern&gt;</i> &mdash; restrict to source roots with the specified name"
  ));
  myPatternLegendLabel.setForeground(new JBColor(Gray._50, Gray._130));
  tweakControls(project);
  myVMOptionsField.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      mySharedVMOptionsField.setEnabled(e.getDocument().getLength() == 0);
      myHeapSizeField.setEnabled(ContainerUtil.find(ParametersListUtil.parse(myVMOptionsField.getText()), new Condition<String>() {
        @Override
        public boolean value(String s) {
          return StringUtil.startsWithIgnoreCase(s, "-Xmx");
        }
      }) == null);
    }
  });
}
项目:intellij-ce-playground    文件:ZoomingDelegate.java   
public void paint(Graphics g) {
  if (myCachedImage != null && myMagnificationPoint != null && myMagnification != 0) {
    double scale = magnificationToScale(myMagnification);
    int xoffset = (int)(myMagnificationPoint.x - myMagnificationPoint.x * scale);
    int yoffset = (int)(myMagnificationPoint.y - myMagnificationPoint.y * scale);

    Rectangle clip = g.getClipBounds();

    g.setColor(Gray._120);
    g.fillRect(clip.x, clip.y, clip.width, clip.height);

    Graphics2D translated = (Graphics2D)g.create();
    translated.translate(xoffset, yoffset);
    translated.scale(scale, scale);

    UIUtil.drawImage(translated, myCachedImage, 0, 0, null);
  }
}
项目:intellij-ce-playground    文件:StatusBarUI.java   
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
  final Graphics2D g2d = (Graphics2D) g.create();

  final Color background = UIUtil.getPanelBackground();

  g2d.setColor(background);
  g2d.fillRect(0, 0, width, height);

  Color topColor = UIUtil.isUnderDarcula() ? BORDER_TOP_COLOR.darker().darker() : BORDER_TOP_COLOR;
  if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
    topColor = Gray.xC9;
  }
  g2d.setColor(topColor);
  g2d.drawLine(0, 0, width, 0);

  if (!UIUtil.isUnderDarcula()) {
    g2d.setColor(BORDER_BOTTOM_COLOR);
    g2d.drawLine(0, height, width, height);
  }

  g2d.dispose();
}
项目:intellij-ce-playground    文件:FloatingDecorator.java   
public final void paint(final Graphics g){
  super.paint(g);
  final JBColor lightGray = new JBColor(Color.lightGray, Gray._95);
  final JBColor gray = new JBColor(Color.gray, Gray._95);
  if(ANCHOR_TOP==myAnchor){
    g.setColor(lightGray);
    UIUtil.drawLine(g, 0, 0, getWidth() - 1, 0);
    UIUtil.drawLine(g, 0, 0, 0, getHeight() - 1);
    g.setColor(JBColor.GRAY);
    UIUtil.drawLine(g, getWidth() - 1, 0, getWidth() - 1, getHeight() - 1);
  } else if(ANCHOR_LEFT==myAnchor){
    g.setColor(lightGray);
    UIUtil.drawLine(g, 0, 0, 0, getHeight() - 1);
  } else {
    if(ANCHOR_BOTTOM==myAnchor){
      g.setColor(lightGray);
      UIUtil.drawLine(g, 0, 0, 0, getHeight() - 1);
      g.setColor(gray);
      UIUtil.drawLine(g, 0, getHeight() - 1, getWidth() - 1, getHeight() - 1);
      UIUtil.drawLine(g, getWidth() - 1, 0, getWidth() - 1, getHeight() - 1);
    } else{ // RIGHT
      g.setColor(gray);
      UIUtil.drawLine(g, getWidth() - 1, 0, getWidth() - 1, getHeight() - 1);
    }
  }
}
项目:intellij-ce-playground    文件:IdeMenuBar.java   
@Override
public Border getBorder() {
  //avoid moving lines
  if (myState == State.EXPANDING || myState == State.COLLAPSING) {
    return new EmptyBorder(0,0,0,0);
  }

  //fix for Darcula double border
  if (myState == State.TEMPORARY_EXPANDED && UIUtil.isUnderDarcula()) {
    return new CustomLineBorder(Gray._75, 0, 0, 1, 0);
  }

  //save 1px for mouse handler
  if (myState == State.COLLAPSED) {
    return new EmptyBorder(0, 0, 1, 0);
  }

  return UISettings.getInstance().SHOW_MAIN_TOOLBAR || UISettings.getInstance().SHOW_NAVIGATION_BAR ? super.getBorder() : null;
}
项目:intellij-ce-playground    文件:EditorEmptyTextPainter.java   
public void paintEmptyText(@NotNull final JComponent splitters, @NotNull Graphics g) {
  UISettings.setupAntialiasing(g);
  g.setColor(new JBColor(Gray._80, Gray._160));
  g.setFont(JBUI.Fonts.label(16f));
  UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.8f);
  advertiseActions(splitters, painter);
  painter.draw(g, new PairFunction<Integer, Integer, Couple<Integer>>() {
    @Override
    public Couple<Integer> fun(Integer width, Integer height) {
      Dimension s = splitters.getSize();
      int w = (s.width - width) / 2;
      int h = s.height * 3 / 8; // fix vertical position @ golden ratio
      return Couple.of(w, h);
    }
  });
}
项目:intellij-ce-playground    文件:ActionToolbarImpl.java   
@Override
protected void paintComponent(final Graphics g) {
  final Insets i = getInsets();
  if (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula()) {
    if (getParent() != null) {
      final JBColor col = new JBColor(Gray._128, Gray._111);
      final Graphics2D g2 = (Graphics2D)g;
      if (myOrientation == SwingConstants.HORIZONTAL) {
        UIUtil.drawDoubleSpaceDottedLine(g2, i.top + 2, getParent().getSize().height - 2 - i.top - i.bottom, 3, col, false);
      } else {
        UIUtil.drawDoubleSpaceDottedLine(g2, i.left + 2, getParent().getSize().width - 2 - i.left - i.right, 3, col, true);
      }
    }
  }
  else {
    g.setColor(UIUtil.getSeparatorColor());
    if (getParent() != null) {
      if (myOrientation == SwingConstants.HORIZONTAL) {
        UIUtil.drawLine(g, 3, 2, 3, getParent().getSize().height - 2);
      }
      else {
        UIUtil.drawLine(g, 2, 3, getParent().getSize().width - 2, 3);
      }
    }
  }
}
项目:intellij-ce-playground    文件:PreviewManagerImpl.java   
@Override
public void paint(Graphics g) {
  boolean isDarkBackground = UIUtil.isUnderDarcula();
  UISettings.setupAntialiasing(g);
  g.setColor(new JBColor(isDarkBackground ? Gray._230 : Gray._80, Gray._160));
  g.setFont(JBUI.Fonts.label(isDarkBackground ? 24f : 20f));

  UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.5f);
  painter.withShadow(true, new JBColor(Gray._200.withAlpha(100), Gray._0.withAlpha(255)));

  painter.appendLine("No files are open");//.underlined(new JBColor(Gray._150, Gray._180));
  painter.draw(g, new PairFunction<Integer, Integer, Couple<Integer>>() {
    @Override
    public Couple<Integer> fun(Integer width, Integer height) {
      Dimension s = EmptyStatePanel.this.getSize();
      return Couple.of((s.width - width) / 2, (s.height - height) / 2);
    }
  });
}
项目:intellij-ce-playground    文件:BegCellRenderer.java   
protected void paintNode(Graphics g) {
  Color color;
  if (mySelected) {
    if (myHasFocus){
      color = getSelectionBackground();
    }
    else{
      color = Gray._223;
    }
  }
  else{
    color = getTextBackground();
    if (color == null){
      color = getBackground();
    }
  }
  if (color != null){
    int i1 = getBorderLeft();
    g.setColor(color);
    g.fillRect(i1 - 1, 0, getWidth() - i1, getHeight());
  }
}
项目:intellij-ce-playground    文件:AboutPopup.java   
public void render(int indentX, int indentY, List<AboutBoxLine> lines) throws OverflowException {
  x = indentX;
  y = indentY;
  ApplicationInfoEx appInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
  for (AboutBoxLine line : lines) {
    final String s = line.getText();
    setFont(line.isBold() ? myBoldFont : myFont);
    if (line.getUrl() != null) {
      g2.setColor(myLinkColor);
      FontMetrics metrics = g2.getFontMetrics(font);
      myLinks.add(new Link(new Rectangle(x, yBase + y - fontAscent, metrics.stringWidth(s), fontHeight), line.getUrl()));
    }
    else {
      g2.setColor(Registry.is("ide.new.about") ? Gray.x33 : appInfo.getAboutForeground());
    }
    renderString(s, indentX);
    if (!line.isKeepWithNext() && !line.equals(lines.get(lines.size()-1))) {
      lineFeed(indentX, s);
    }
  }
}
项目:intellij-ce-playground    文件:MacIntelliJTextBorder.java   
@Override
public void paintBorder(Component c, Graphics g2d, int x, int y, int width, int height) {
  if (TextFieldWithPopupHandlerUI.isSearchField(c)) {
    return;
  }
  Graphics2D g = (Graphics2D)g2d;
  //todo[kb]: make a better solution
  if (c.getParent() instanceof JComboBox) return;
  if (c.hasFocus()) {
    MacIntelliJBorderPainter.paintBorder(c, g, 0, 0, c.getWidth(), c.getHeight());
  }
  if (!IntelliJLaf.isGraphite() || !c.hasFocus()) {
    g.setColor(Gray.xB4);
    g.drawRect(3, 3, c.getWidth() - 6, c.getHeight() - 6);
  }
}
项目:intellij-ce-playground    文件:PluginHeaderPanel.java   
public PluginHeaderPanel(@Nullable PluginManagerMain manager) {
  myManager = manager;
  final Font font = myName.getFont();
  myName.setFont(new Font(font.getFontName(), font.getStyle(), font.getSize() + 2));
  final JBColor greyed = new JBColor(Gray._130, Gray._200);
  myCategory.setForeground(greyed);
  myDownloads.setForeground(greyed);
  myUpdated.setForeground(greyed);
  myVersion.setForeground(greyed);
  final Font smallFont = new Font(font.getFontName(), font.getStyle(), font.getSize() - 1);
  myCategory.setFont(smallFont);
  myVersion.setFont(smallFont);
  myDownloads.setFont(smallFont);
  myUpdated.setFont(smallFont);
  myRoot.setVisible(false);
}
项目:intellij-ce-playground    文件:ColorIcon.java   
@Override
public void paintIcon(final Component component, final Graphics g, final int i, final int j) {
  final int iconWidth = getIconWidth();
  final int iconHeight = getIconHeight();
  g.setColor(getIconColor());

  final int x = i + (iconWidth - myColorSize) / 2;
  final int y = j + (iconHeight - myColorSize) / 2;

  g.fillRect(x, y, myColorSize, myColorSize);

  if (myBorder) {
    g.setColor(Gray.x00.withAlpha(40));
    g.drawRect(x, y, myColorSize, myColorSize);
  }
}
项目:intellij-ce-playground    文件:BreadcrumbsXmlWrapper.java   
@Override
public void itemHovered(@Nullable BreadcrumbsPsiItem item) {
  if (!Registry.is("editor.breadcrumbs.highlight.on.hover")) {
    return;
  }

  HighlightManager hm = HighlightManager.getInstance(myProject);
  if (myHighlighed != null) {
    for (RangeHighlighter highlighter : myHighlighed) {
      hm.removeSegmentHighlighter(myEditor, highlighter);
    }
    myHighlighed = null;
  }
  if (item != null) {
    final TextRange range = item.getPsiElement().getTextRange();
    final TextAttributes attributes = new TextAttributes();
    final CrumbPresentation p = item.getPresentation();
    final Color color = p != null ? p.getBackgroundColor(false, false, false) : BreadcrumbsComponent.ButtonSettings.DEFAULT_BG_COLOR;
    final Color background = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.CARET_ROW_COLOR);
    attributes.setBackgroundColor(XmlTagTreeHighlightingUtil.makeTransparent(color, background != null ? background : Gray._200, 0.3));
    myHighlighed = new ArrayList<RangeHighlighter>(1);
    int flags = HighlightManager.HIDE_BY_ESCAPE | HighlightManager.HIDE_BY_TEXT_CHANGE | HighlightManager.HIDE_BY_ANY_KEY;
    hm.addOccurrenceHighlight(myEditor, range.getStartOffset(), range.getEndOffset(), attributes, flags, myHighlighed, null);
  }
}
项目:intellij-ce-playground    文件:ColorComponent.java   
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
  if (myColor.getAlpha() != 0xff) {
    final RoundRectangle2D.Double clip =
      new RoundRectangle2D.Double(x, y, myCellSize, myCellSize, ARC_SIZE, ARC_SIZE);
    GraphicsUtil.paintCheckeredBackground(g, clip);
  }

  g.setColor(myColor);
  g.fillRoundRect(x, y, myCellSize, myCellSize, ARC_SIZE, ARC_SIZE);

  myColor.getRGBComponents(myRgbaArray);
  if (Math.pow(1.0 - myRgbaArray[0], 2) + Math.pow(1.0 - myRgbaArray[1], 2) + Math.pow(1.0 - myRgbaArray[2], 2) < THRESHOLD_SQUARED_DISTANCE) {
    // Drawing a border to avoid displaying white boxes on a white background
    g.setColor(Gray._239);
    g.drawRoundRect(x, y, myCellSize, myCellSize - 1, ARC_SIZE, ARC_SIZE);
  }
}
项目:intellij-ce-playground    文件:IdeaDecompiler.java   
@Nullable
@Override
protected JComponent createCenterPanel() {
  JPanel iconPanel = new JBPanel(new BorderLayout());
  iconPanel.add(new JBLabel(AllIcons.General.WarningDialog), BorderLayout.NORTH);

  myMessage = new JEditorPane();
  myMessage.setEditorKit(UIUtil.getHTMLEditorKit());
  myMessage.setEditable(false);
  myMessage.setPreferredSize(JBUI.size(500, 100));
  myMessage.setBorder(BorderFactory.createLineBorder(Gray._200));
  String text = "<div style='margin:5px;'>" + IdeaDecompilerBundle.message("legal.notice.text") + "</div>";
  myMessage.setText(text);

  JPanel panel = new JBPanel(new BorderLayout(10, 0));
  panel.add(iconPanel, BorderLayout.WEST);
  panel.add(myMessage, BorderLayout.CENTER);
  return panel;
}
项目:material-theme-jetbrains    文件:UIReplacer.java   
static void patchStatusBar() throws Exception {
  if (MTConfig.getInstance().isMaterialTheme()) {
    // Replace Gray with a clear and transparent color
    final Gray gray = Gray._85;
    final Color alphaGray = gray.withAlpha(1);
    StaticPatcher.setFinalStatic(Gray.class, "_85", alphaGray);
    StaticPatcher.setFinalStatic(Gray.class, "_40", alphaGray);
    StaticPatcher.setFinalStatic(Gray.class, "_145", alphaGray);
    //        StaticPatcher.setFinalStatic(Gray.class, "_255", alphaGray);
    StaticPatcher.setFinalStatic(Gray.class, "_201", alphaGray);

    // Quick info border
    StaticPatcher.setFinalStatic(Gray.class, "_90", gray.withAlpha(25));

    // tool window color
    final boolean dark = MTConfig.getInstance().getSelectedTheme().isDark();
    StaticPatcher.setFinalStatic(Gray.class, "_15", dark ? Gray._15.withAlpha(255) : Gray._200.withAlpha(15));
    // This thing doesnt work on compiled jars...
    final Class<?> clazz = Class.forName("com.intellij.openapi.wm.impl.status.StatusBarUI$BackgroundPainter");

    StaticPatcher.setFinalStatic(clazz, "BORDER_TOP_COLOR", UIManager.getColor("StatusBar.topColor").brighter().brighter());
    StaticPatcher.setFinalStatic(clazz, "BORDER2_TOP_COLOR", UIManager.getColor("StatusBar.topColor2"));
    StaticPatcher.setFinalStatic(clazz, "BORDER_BOTTOM_COLOR", UIManager.getColor("StatusBar.bottomColor"));
    StaticPatcher.setFinalStatic(SettingsTreeView.class, "FOREGROUND", UIManager.getColor("Tree.foreground"));
  }
}
项目:GitToolBox    文件:ColoredNodeDecoration.java   
private ColoredFragment makeStatusFragment(boolean prefix) {
  int style = SimpleTextAttributes.STYLE_PLAIN;
  if (config.projectViewStatusBold) {
    style |= SimpleTextAttributes.STYLE_BOLD;
  }
  if (config.projectViewStatusItalic) {
    style |= SimpleTextAttributes.STYLE_ITALIC;
  }
  Color color = config.projectViewStatusCustomColor ? config.getProjectViewStatusColor() : Gray._128;
  SimpleTextAttributes attributes = new SimpleTextAttributes(style, color);
  StringBand status = getStatusText();
  if (prefix) {
    String statusTemp = status.toString();
    status.setIndex(0);
    status.append(FontUtil.spaceAndThinSpace()).append(statusTemp);
  }
  return new ColoredFragment(status.toString(), attributes);
}
项目:tools-idea    文件:CompilerUIConfigurable.java   
public CompilerUIConfigurable(@NotNull final Project project) {
  myProject = project;

  myPatternLegendLabel.setText("<html><body>" +
                               "Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern. " +
                               "Accepted wildcards: <b>?</b> &mdash; exactly one symbol; <b>*</b> &mdash; zero or more symbols; " +
                               "<b>/</b> &mdash; path separator; <b>/**/</b> &mdash; any number of directories; " +
                               "<i>&lt;dir_name&gt;</i>:<i>&lt;pattern&gt;</i> &mdash; restrict to source roots with the specified name" +
                               "</body></html>");
  myPatternLegendLabel.setForeground(new JBColor(Gray._50, Gray._130));
  myCbUseExternalBuild.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent e) {
      updateExternalMakeOptionControls(myCbUseExternalBuild.isSelected());
    }
  });

  tweakControls(project);
}
项目:tools-idea    文件:DarculaEditorTabsPainter.java   
@Override
public void doPaintInactive(Graphics2D g2d,
                            Rectangle effectiveBounds,
                            int x,
                            int y,
                            int w,
                            int h,
                            Color tabColor,
                            int row,
                            int column,
                            boolean vertical) {
  if (tabColor != null) {
    g2d.setColor(tabColor);
    g2d.fillRect(x, y, w, h);
  } else {
    g2d.setPaint(UIUtil.getControlColor());
    g2d.fillRect(x, y, w, h);
  }

  g2d.setColor(Gray._0.withAlpha(10));
  g2d.drawRect(x, y, w - 1, h - 1);
}
项目:tools-idea    文件:DarculaEditorTabsPainter.java   
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  final int h = rectangle.height;
  g.setPaint(UIUtil.getGradientPaint(x, y, Gray._78.withAlpha(160), x, y + h, Gray._78.withAlpha(120)));
  final int w = rectangle.width;
  g.fillRect(x, rectangle.y, w, h + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._78);
    g.drawLine(x, rectangle.y, x + w, rectangle.y);
  }
}
项目:tools-idea    文件:DefaultEditorTabsPainter.java   
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  g.setPaint(UIUtil.getGradientPaint(x, y, new Color(255, 255, 255, 160),
                               x, rectangle.y + rectangle.height, new Color(255, 255, 255, 120)));
  g.fillRect(x, rectangle.y, rectangle.width, rectangle.height + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._210);
    g.drawLine(x, rectangle.y, x + rectangle.width, rectangle.y);

    drawShadow(g, rectangle.x, rectangle.width, rectangle.y + rectangle.height);
  }
}
项目:tools-idea    文件:ZoomingDelegate.java   
public void paint(Graphics g) {
  if (myCachedImage != null && myMagnificationPoint != null && myMagnification != 0) {
    double scale = magnificationToScale(myMagnification);
    int xoffset = (int)(myMagnificationPoint.x - myMagnificationPoint.x * scale);
    int yoffset = (int)(myMagnificationPoint.y - myMagnificationPoint.y * scale);

    Rectangle clip = g.getClipBounds();

    g.setColor(Gray._120);
    g.fillRect(clip.x, clip.y, clip.width, clip.height);

    Graphics2D translated = (Graphics2D)g.create();
    translated.translate(xoffset, yoffset);
    translated.scale(scale, scale);

    UIUtil.drawImage(translated, myCachedImage, 0, 0, null);
  }
}
项目:tools-idea    文件:FloatingDecorator.java   
public final void paint(final Graphics g){
  super.paint(g);
  final JBColor lightGray = new JBColor(Color.lightGray, Gray._95);
  final JBColor gray = new JBColor(Color.gray, Gray._95);
  if(ANCHOR_TOP==myAnchor){
    g.setColor(lightGray);
    UIUtil.drawLine(g, 0, 0, getWidth() - 1, 0);
    UIUtil.drawLine(g, 0, 0, 0, getHeight() - 1);
    g.setColor(JBColor.GRAY);
    UIUtil.drawLine(g, getWidth() - 1, 0, getWidth() - 1, getHeight() - 1);
  } else if(ANCHOR_LEFT==myAnchor){
    g.setColor(lightGray);
    UIUtil.drawLine(g, 0, 0, 0, getHeight() - 1);
  } else {
    if(ANCHOR_BOTTOM==myAnchor){
      g.setColor(lightGray);
      UIUtil.drawLine(g, 0, 0, 0, getHeight() - 1);
      g.setColor(gray);
      UIUtil.drawLine(g, 0, getHeight() - 1, getWidth() - 1, getHeight() - 1);
      UIUtil.drawLine(g, getWidth() - 1, 0, getWidth() - 1, getHeight() - 1);
    } else{ // RIGHT
      g.setColor(gray);
      UIUtil.drawLine(g, getWidth() - 1, 0, getWidth() - 1, getHeight() - 1);
    }
  }
}
项目:tools-idea    文件:IdeMenuBar.java   
@Override
public Border getBorder() {
  //avoid moving lines
  if (myState == State.EXPANDING || myState == State.COLLAPSING) {
    return new EmptyBorder(0,0,0,0);
  }

  //fix for Darcula double border
  if (myState == State.TEMPORARY_EXPANDED && UIUtil.isUnderDarcula()) {
    return new CustomLineBorder(Gray._75, 0, 0, 1, 0);
  }

  //save 1px for mouse handler
  if (myState == State.COLLAPSED) {
    return new EmptyBorder(0, 0, 1, 0);
  }

  return super.getBorder();
}
项目:tools-idea    文件:FileEditorManagerImpl.java   
private void initUI() {
  if (myPanels == null) {
    synchronized (myInitLock) {
      if (myPanels == null) {
        myPanels = new JPanel(new BorderLayout()) {
          @Override
          public Color getBackground() {
            boolean navBar = UISettings.getInstance().SHOW_NAVIGATION_BAR;
            if (navBar) {
              return  UIUtil.getSlightlyDarkerColor(UIUtil.isUnderAquaLookAndFeel() ? Gray._200 : UIUtil.getPanelBackground());
            } else {
              return UIUtil.isUnderAquaLookAndFeel() ? Gray._189 : UIUtil.getPanelBackground();
            }
          }
        };
        myPanels.setBorder(new MyBorder());
        mySplitters = new EditorsSplitters(this, myDockManager, true);
        myPanels.add(mySplitters, BorderLayout.CENTER);
      }
    }
  }
}
项目:tools-idea    文件:ActionToolbarImpl.java   
@Override
protected void paintComponent(final Graphics g) {
  final Insets i = getInsets();
  if (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula()) {
    if (getParent() != null) {
      final JBColor col = new JBColor(Color.GRAY, Gray._111);
      final Graphics2D g2 = (Graphics2D)g;
      if (myOrientation == SwingConstants.HORIZONTAL) {
        UIUtil.drawDoubleSpaceDottedLine(g2, i.top + 2, getParent().getSize().height - 2 - i.top - i.bottom, 3, col, false);
      } else {
        UIUtil.drawDoubleSpaceDottedLine(g2, i.left + 2, getParent().getSize().width - 2 - i.left - i.right, 3, col, true);
      }
    }
  }
  else {
    g.setColor(UIUtil.getSeparatorColor());
    if (getParent() != null) {
      if (myOrientation == SwingConstants.HORIZONTAL) {
        UIUtil.drawLine(g, 3, 2, 3, getParent().getSize().height - 2);
      }
      else {
        UIUtil.drawLine(g, 2, 3, getParent().getSize().width - 2, 3);
      }
    }
  }
}
项目:tools-idea    文件:EditorHeaderComponent.java   
@Override
protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  Color GRADIENT_C1 = new JBColor(getBackground(), JBColor.background());
  Color GRADIENT_C2 = new JBColor(new Color(Math.max(0, GRADIENT_C1.getRed() - 0x18), Math.max(0, GRADIENT_C1.getGreen() - 0x18),
                                            Math.max(0, GRADIENT_C1.getBlue() - 0x18)), Gray._75);

  final Graphics2D g2d = (Graphics2D)g;

  if (!UIUtil.isUnderGTKLookAndFeel()) {
    g2d.setPaint(UIUtil.getGradientPaint(0, 0, GRADIENT_C1, 0, getHeight(), GRADIENT_C2));
    g2d.fillRect(1, 1, getWidth(), getHeight() - 1);
    g2d.setPaint(null);
  }

  g.setColor(UIUtil.getBorderColor());
  g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
}
项目:tools-idea    文件:BegCellRenderer.java   
protected void paintNode(Graphics g) {
  Color color;
  if (mySelected) {
    if (myHasFocus){
      color = getSelectionBackground();
    }
    else{
      color = Gray._223;
    }
  }
  else{
    color = getTextBackground();
    if (color == null){
      color = getBackground();
    }
  }
  if (color != null){
    int i1 = getBorderLeft();
    g.setColor(color);
    g.fillRect(i1 - 1, 0, getWidth() - i1, getHeight());
  }
}
项目:tools-idea    文件:DarculaButtonPainter.java   
@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();
  }
}
项目:tools-idea    文件:DarculaTextBorder.java   
@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();
}
项目:tools-idea    文件:JBRunnerTabs.java   
@Override
protected void doPaintInactive(Graphics2D g2d,
                               boolean leftGhostExists,
                               TabLabel label,
                               Rectangle effectiveBounds,
                               boolean rightGhostExists, int row, int column) {
  Insets insets = getTabsBorder().getEffectiveBorder();
  final boolean dark = UIUtil.isUnderDarcula();
  int _x = effectiveBounds.x + insets.left;
  int _y = effectiveBounds.y + insets.top + 3;
  int _width = effectiveBounds.width - insets.left - insets.right;
  int _height = effectiveBounds.height - insets.top - insets.bottom - 3;
  _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
  if (dark) {
    g2d.setPaint(UIUtil.getGradientPaint(_x, _y, ColorUtil.shift(UIUtil.getListBackground(), 1.3), _x, _y + effectiveBounds.height, UIUtil.getPanelBackground()));
    g2d.fillRect(_x, _y, _width, _height);

    g2d.setColor(Gray._0.withAlpha(50));
  } else {
    g2d.setPaint(UIUtil.getGradientPaint(_x, _y, new Color(255, 255, 255, 180), _x, _y + effectiveBounds.height, new Color(255, 255, 255, 100)));
    g2d.fillRect(_x, _y, _width, _height);

    g2d.setColor(new Color(255, 255, 255, 100));
    g2d.drawRect(_x, _y, _width - 1, _height - 1);
  }
}
项目:jediterm    文件:ZoomingDelegate.java   
public void paint(Graphics g) {
  if (myCachedImage != null && myMagnificationPoint != null && myMagnification != 0) {
    double scale = magnificationToScale(myMagnification);
    int xoffset = (int)(myMagnificationPoint.x - myMagnificationPoint.x * scale);
    int yoffset = (int)(myMagnificationPoint.y - myMagnificationPoint.y * scale);

    Rectangle clip = g.getClipBounds();

    g.setColor(Gray._120);
    g.fillRect(clip.x, clip.y, clip.width, clip.height);

    Graphics2D translated = (Graphics2D)g.create();
    translated.translate(xoffset, yoffset);
    translated.scale(scale, scale);

    UIUtil.drawImage(translated, myCachedImage, 0, 0, null);
  }
}
项目:consulo    文件:ActionButtonUI.java   
protected void paintBackground(ActionButton button, Graphics g, Dimension size, int state) {
  if (UIUtil.isUnderAquaLookAndFeel()) {
    if (state == ActionButtonComponent.PUSHED) {
      ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, ALPHA_40, size.width, size.height, ALPHA_20));
      g.fillRect(0, 0, size.width - 1, size.height - 1);

      g.setColor(ALPHA_120);
      g.drawLine(0, 0, 0, size.height - 2);
      g.drawLine(1, 0, size.width - 2, 0);

      g.setColor(ALPHA_30);
      g.drawRect(1, 1, size.width - 3, size.height - 3);
    }
    else if (state == ActionButtonComponent.POPPED) {
      ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, Gray._235, 0, size.height, Gray._200));
      g.fillRect(1, 1, size.width - 3, size.height - 3);
    }
  }
  else {
    final Color bg = UIUtil.getPanelBackground();
    final boolean dark = UIUtil.isUnderDarcula();
    g.setColor(state == ActionButtonComponent.PUSHED ? ColorUtil.shift(bg, dark ? 1d / 0.7d : 0.7d) : dark ? Gray._255.withAlpha(40) : ALPHA_40);
    g.fillRect(JBUI.scale(1), JBUI.scale(1), size.width - JBUI.scale(2), size.height - JBUI.scale(2));
  }
}
项目:consulo    文件:IntelliJEditorTabsUI.java   
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  g.setPaint(UIUtil.getGradientPaint(x, y, new Color(255, 255, 255, 160), x, rectangle.y + rectangle.height, new Color(255, 255, 255, 120)));
  g.fillRect(x, rectangle.y, rectangle.width, rectangle.height + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._210);
    g.drawLine(x, rectangle.y, x + rectangle.width, rectangle.y);

    drawShadow(g, rectangle.x, rectangle.width, rectangle.y + rectangle.height);
  }
}
项目:consulo    文件:DarculaEditorTabsUI.java   
@Override
public void doPaintInactiveImpl(Graphics2D g2d,
                                Rectangle effectiveBounds,
                                int x,
                                int y,
                                int w,
                                int h,
                                Color tabColor,
                                int row,
                                int column,
                                boolean vertical) {
  if (tabColor != null) {
    g2d.setColor(tabColor);
    g2d.fillRect(x, y, w, h);
  }
  else {
    g2d.setPaint(UIUtil.getControlColor());
    g2d.fillRect(x, y, w, h);
  }

  g2d.setColor(Gray._0.withAlpha(10));
  g2d.drawRect(x, y, w - 1, h - 1);
}
项目:consulo    文件:DarculaEditorTabsUI.java   
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  final int h = rectangle.height;
  g.setPaint(UIUtil.getGradientPaint(x, y, Gray._78.withAlpha(160), x, y + h, Gray._78.withAlpha(120)));
  final int w = rectangle.width;
  g.fillRect(x, rectangle.y, w, h + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._78);
    g.drawLine(x, rectangle.y, x + w, rectangle.y);
  }
}
项目:consulo    文件:ModernButtonlessScrollBarUI.java   
private void paintMaxiThumb(Graphics2D g, JComponent c, Rectangle thumbBounds) {
  final boolean vertical = isVertical();
  int hGap = 0;
  int vGap = 0;

  int w = thumbBounds.width;
  int h = thumbBounds.height;

  if (vertical) {
    vGap -= JBUI.scale(1);
    h += JBUI.scale(1);
  }
  else {
    hGap -= JBUI.scale(1);
    w += JBUI.scale(1);
  }

  g.setColor(adjustColor(new JBColor(Gray._230, Gray._80)));
  g.fillRect(hGap, vGap, w, h);

  g.setColor(new JBColor(Gray._201, Gray._85));
  g.drawRect(hGap, vGap, w, h);
}
项目:consulo    文件:ModernDarkEditorTabsUI.java   
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  final int h = rectangle.height;
  g.setPaint(Gray._78.withAlpha(120));
  final int w = rectangle.width;
  g.fillRect(x, rectangle.y, w, h + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._78);
    g.drawLine(x, rectangle.y, x + w, rectangle.y);
  }
}
项目:consulo    文件:MacEditorTabsUI.java   
@Override
public void doPaintBackground(Graphics2D g, Rectangle clip, boolean vertical, Rectangle rectangle) {
  g.setColor(UIUtil.getPanelBackground());
  g.fill(clip);

  g.setColor(new Color(0, 0, 0, 80));
  g.fill(clip);

  final int x = rectangle.x;
  final int y = rectangle.y;
  g.setPaint(new Color(255, 255, 255, 160));
  g.fillRect(x, rectangle.y, rectangle.width, rectangle.height + (vertical ? 1 : 0));

  if (!vertical) {
    g.setColor(Gray._210);
    g.drawLine(x, rectangle.y, x + rectangle.width, rectangle.y);

    drawShadow(g, rectangle.x, rectangle.width, rectangle.y + rectangle.height);
  }
}