Java Code Examples for com.intellij.util.ui.UIUtil#getPanelBackground()

The following examples show how to use com.intellij.util.ui.UIUtil#getPanelBackground() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PoppedIcon.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void paintBackground(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));
  }
}
 
Example 2
Source File: CommanderPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public final void setActive(final boolean active) {
  myActive = active;
  if (active) {
    myTitlePanel.setBackground(DARK_BLUE);
    myTitlePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, DARK_BLUE_BRIGHTER, DARK_BLUE_DARKER));
    myParentTitle.setForeground(Color.white);
  }
  else {
    final Color color = UIUtil.getPanelBackground();
    LOG.assertTrue(color != null);
    myTitlePanel.setBackground(color);
    myTitlePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, color.brighter(), color.darker()));
    myParentTitle.setForeground(JBColor.foreground());
  }
  final int[] selectedIndices = myList.getSelectedIndices();
  if (selectedIndices.length == 0 && myList.getModel().getSize() > 0) {
    myList.setSelectedIndex(0);
    if (!myList.hasFocus()) {
      IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(myList);
    }
  }
  else if (myList.getModel().getSize() > 0) {
    // need this to generate SelectionChanged events so that listeners, added by Commander, will be notified
    myList.setSelectedIndices(selectedIndices);
  }
}
 
Example 3
Source File: LoadingDecorator.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void setVisible(final boolean visible, boolean takeSnapshot) {
  if (myVisible == visible) return;

  if (myVisible && !visible && myCurrentAlpha != -1) return;

  myVisible = visible;
  myFadeOutAnimator.reset();
  if (myVisible) {
    setVisible(myVisible);
    myCurrentAlpha = -1;

    if (takeSnapshot && getWidth() > 0 && getHeight() > 0) {
      mySnapshot = UIUtil.createImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
      final Graphics2D g = mySnapshot.createGraphics();
      myPane.paint(g);
      final Component opaque = UIUtil.findNearestOpaque(this);
      mySnapshotBg = opaque != null ? opaque.getBackground() : UIUtil.getPanelBackground();
      g.dispose();
    }
    myProgress.resume();

    myFadeOutAnimator.suspend();
  }
  else {
    disposeSnapshot();
    myProgress.suspend();

    myFadeOutAnimator.resume();
  }
}
 
Example 4
Source File: SearchTextField.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  if (myToggleHistoryLabel != null) {
    final Color bg = enabled ? UIUtil.getTextFieldBackground() : UIUtil.getPanelBackground();
    myToggleHistoryLabel.setBackground(bg);
    myClearFieldLabel.setBackground(bg);
  }
}
 
Example 5
Source File: DesktopStripePanelImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void setOverlayed(boolean overlayed) {
  if (Registry.is("disable.toolwindow.overlay")) return;

  Color bg = UIUtil.getPanelBackground();
  if (UIUtil.isUnderAquaLookAndFeel()) {
    float[] result = Color.RGBtoHSB(bg.getRed(), bg.getGreen(), bg.getBlue(), new float[3]);
    bg = new Color(Color.HSBtoRGB(result[0], result[1], result[2] - 0.08f > 0 ? result[2] - 0.08f : result[2]));
  }
  if (overlayed) {
    setBackground(ColorUtil.toAlpha(bg, 190));
  }
  else {
    setBackground(bg);
  }
}
 
Example 6
Source File: ActionButtonUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void paintBackground(ActionButton button, Graphics g, Dimension size, int state) {
  if (state == ActionButtonComponent.NORMAL && !button.isBackgroundSet()) return;

  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));
  }
}
 
Example 7
Source File: IdeaLookAndFeelService.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
@Override
public Color getBackgroundColor() {
    return UIUtil.getPanelBackground();
}
 
Example 8
Source File: TabContentLayout.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static Color getColor(boolean selected, boolean hovered) {
  Color color = selected && hovered ? SwingUIDecorator.get(SwingUIDecorator::getSidebarColor) : UIUtil.getPanelBackground();
  return StyleManager.get().getCurrentStyle().isDark() ? color.brighter() : color.darker();
}