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

项目:react-native-console    文件:SimpleToolWindowPanel.java   
@Override
protected void paintComponent(final Graphics g) {
  super.paintComponent(g);

  g.setColor(JBColor.border());//UIUtil.getBorderColor() is deprecated

  if (myWestToolbar != null && myWestToolbar.getParent() == this && myContent != null && myContent.getParent() == this) {
      int x = (int) myWestToolbar.getBounds().getMaxX();
      g.drawLine(x, 0, x, getHeight());
  }

  if (myNorthToolbar != null && myNorthToolbar.getParent() == this && myContent != null && myContent.getParent() == this) {
    final int y = (int) myNorthToolbar.getBounds().getMaxY();
    g.drawLine(0, y, getWidth(), y);
  }

}
项目:SearchResourcePlugin    文件:ResultElementListCellRenderer.java   
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
    Color bgColor = UIUtil.getListBackground();
    setPaintFocusBorder(hasFocus && UIUtil.isToUseDottedCellBorder());

    if (value instanceof SearchResultElement) {
        SearchResultElement element = (SearchResultElement) value;
        String stringKeyText = "(" + element.getName() + ")";
        String text = new StringEllipsisPolicy().ellipsizeText(element.getValue(), matcher);

        SimpleTextAttributes nameAttributes = new SimpleTextAttributes(Font.PLAIN, list.getForeground());
        SpeedSearchUtil.appendColoredFragmentForMatcher(text, this, nameAttributes, matcher, bgColor, selected);
        append(" " + stringKeyText, new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
    }

    setBackground(selected ? UIUtil.getListSelectionBackground() : bgColor);
}
项目:educational-plugin    文件:StudyUtils.java   
public static void drawAllAnswerPlaceholders(Editor editor, TaskFile taskFile) {
  editor.getMarkupModel().removeAllHighlighters();
  final Project project = editor.getProject();
  if (project == null) return;
  final StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
  for (AnswerPlaceholder answerPlaceholder : taskFile.getAnswerPlaceholders()) {
    final JBColor color = taskManager.getColor(answerPlaceholder);
    EduAnswerPlaceholderPainter.drawAnswerPlaceholder(editor, answerPlaceholder, color);
  }

  final Document document = editor.getDocument();
  EditorActionManager.getInstance()
    .setReadonlyFragmentModificationHandler(document, new EduAnswerPlaceholderDeleteHandler(editor));
  EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile);
  editor.getColorsScheme().setColor(EditorColors.READONLY_FRAGMENT_BACKGROUND_COLOR, null);
}
项目:educational-plugin    文件:StudyToolWindow.java   
private JPanel createCourseProgress(@NotNull final Project project) {
  JPanel contentPanel = new JPanel();
  contentPanel.setBackground(JBColor.WHITE);
  contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
  contentPanel.add(Box.createRigidArea(new Dimension(10, 0)));
  contentPanel.add(Box.createRigidArea(new Dimension(0, 10)));
  myStudyProgressBar = new StudyProgressBar(0, 20, 10);

  myStatisticLabel = new JLabel("", SwingConstants.LEFT);
  contentPanel.add(myStatisticLabel);
  contentPanel.add(myStudyProgressBar);

  contentPanel.setPreferredSize(new Dimension(100, 60));
  contentPanel.setMinimumSize(new Dimension(300, 40));
  updateCourseProgress(project);
  return contentPanel;
}
项目:educational-plugin    文件:EduAnswerPlaceholderPainter.java   
public static void drawAnswerPlaceholder(@NotNull final Editor editor, @NotNull final AnswerPlaceholder placeholder,
                                         @NotNull final JBColor color) {
  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  final TextAttributes textAttributes = new TextAttributes(scheme.getDefaultForeground(), scheme.getDefaultBackground(), null,
                                                           EffectType.BOXED, Font.PLAIN);
  textAttributes.setEffectColor(color);
  int startOffset = placeholder.getOffset();
  if (startOffset == -1) {
    return;
  }
  final int length =
    placeholder.isActive() ? placeholder.getRealLength() : placeholder.getVisibleLength(placeholder.getActiveSubtaskIndex());
  Pair<Integer, Integer> offsets = StudyUtils.getPlaceholderOffsets(placeholder, editor.getDocument());
  startOffset = offsets.first;
  int endOffset = offsets.second;
  if (placeholder.isActive()) {
    drawAnswerPlaceholder(editor, startOffset, endOffset, textAttributes, PLACEHOLDERS_LAYER);
  }
  else if (!placeholder.getUseLength() && length != 0) {
    drawAnswerPlaceholderFromPrevStep(editor, startOffset, endOffset);
  }
}
项目:processing-idea    文件:ProcessingSketchRootSelectStep.java   
private void refreshPdeFileImportPreview() {
    if (! getParameters().importablePdeFiles.isEmpty()) {
        filesDetectedLabel.setForeground(JBColor.BLACK);
        filesDetectedLabel.setText(getParameters().importablePdeFiles.size() + " PDE files");

        StringJoiner importablePdeFilePaths = new StringJoiner("\n");

        for (VirtualFile importablePdeFile : getParameters().importablePdeFiles) {
            importablePdeFilePaths.add(importablePdeFile.getPath());
        }

        importableClassesListTextArea.setText(importablePdeFilePaths.toString());
    } else {
        importableClassesListTextArea.setText("No sketch classes were found at this root directory.");
        filesDetectedLabel.setText("0 PDE files");
        filesDetectedLabel.setForeground(JBColor.RED);
    }
}
项目:GravSupport    文件:ValueEnteredTableCellRenderer.java   
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    // Cells are by default rendered as a JLabel.
    JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
    //Get the status for the current row.
    TranslationTableModel tableModel = (TranslationTableModel) table.getModel();
    if (col != 0 && tableModel.getStatus(row, col) == TranslationTableModel.EMPTY) {
        l.setBackground(new JBColor(new Color(244, 128, 36, 60), new Color(244, 128, 36)));
    } else {
        if(isSelected) {
            l.setForeground(EditorColorsManager.getInstance().getSchemeForCurrentUITheme().getDefaultForeground());
        }
        l.setBackground(EditorColorsManager.getInstance().getSchemeForCurrentUITheme().getDefaultBackground());
    }

    return l;
}
项目:intellij-ce-playground    文件:DisposerDebugger.java   
@Override
protected void update(PresentationData presentation) {
  if (getValue() != null) {
    final Object object = getValue().getObject();
    final String classString = object.getClass().toString();
    final String objectString = object.toString();

    presentation.setPresentableText(objectString);

    if (getValue().getOwnModification() < myTree.myModificationToFilter) {
      presentation.setForcedTextForeground(JBColor.GRAY);
    }

    if (objectString != null) {
      final int dogIndex = objectString.lastIndexOf("@");
      if (dogIndex >= 0) {
        final String fqNameObject = objectString.substring(0, dogIndex);
        final String fqNameClass = classString.substring("class ".length());
        if (fqNameObject.equals(fqNameClass)) return;
      }
    }

    presentation.setLocationString(classString);
  }
}
项目:intellij-ce-playground    文件:CpuMonitorView.java   
public CpuMonitorView(@NotNull Project project, @NotNull DeviceContext deviceContext) {
  super(project);

  // Buffer at one and a half times the sample frequency.
  float bufferTimeInSeconds = SAMPLE_FREQUENCY_MS * 1.5f / 1000.f;
  float initialMax = 100.0f;
  float initialMarker = 10.0f;

  TimelineData data = new TimelineData(2, SAMPLES);
  EventData events = new EventData();
  TimelineComponent timelineComponent = new TimelineComponent(data, events, bufferTimeInSeconds, initialMax, 100, initialMarker);

  timelineComponent.configureUnits("%");
  timelineComponent.configureStream(0, "Kernel", new JBColor(0xd73f3f, 0xd73f3f));
  timelineComponent.configureStream(1, "User", new JBColor(0xeb9f9f, 0x9d4c4c));
  timelineComponent.setBackground(BACKGROUND_COLOR);

  setComponent(timelineComponent);

  myCpuSampler = new CpuSampler(data, SAMPLE_FREQUENCY_MS);
  myCpuSampler.addListener(this);

  myDeviceContext = deviceContext;
  myDeviceContext.addListener(this, project);
}
项目:intellij-nette-tester    文件:TesterConfigurableForm.java   
private void createUIComponents() {
    defaultExtensionLabel = new JBLabel(TesterBundle.message("settings.defaultExtension"));
    defaultExtensionCombobox = new ComboBox<>(new String[]{"phpt", "php"});

    bootstrapFileLabel = new JBLabel(TesterBundle.message("settings.bootstrapFile"));
    bootstrapFileField = new TextFieldWithBrowseButton();
    bootstrapFileField.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));

    namespaceMappingTable = new NamespaceMappingTable(project);
    namespaceMappingPanel = ToolbarDecorator.createDecorator(namespaceMappingTable.getTableView(), new ElementProducer<TesterNamespaceMapping>() {
        @Override
        public TesterNamespaceMapping createElement() {
            return new TesterNamespaceMapping();
        }

        @Override
        public boolean canCreateElement() {
            return true;
        }
    }).createPanel();

    namespaceMappingPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.LIGHT_GRAY), TesterBundle.message("settings.namespaceMappings.title")));
}
项目:intellij-swagger    文件:SwaggerUIViewer.java   
public SwaggerUIViewer() {
    super(new BorderLayout());
    this.setBackground(JBColor.background());
    this.setVisible(false);
    Platform.setImplicitExit(false);

    ApplicationManager
            .getApplication()
            .invokeLater(() -> PlatformImpl.startup(this::createWebView));
}
项目:tmc-intellij    文件:SuccessfulSubmissionDialog.java   
private void addYayLabel() {
    logger.info("Adding yay label. @SuccessfulSubmissionDialog");
    JLabel yayLabel = new JLabel("All tests passed on the server.");

    Font font = yayLabel.getFont();
    font = font.deriveFont(Font.BOLD, font.getSize2D() * 1.2f);
    yayLabel.setFont(font);

    yayLabel.setForeground(new JBColor(new Color(0, 153, 51), new Color(0, 153, 51)));
    yayLabel.setIcon(TmcIcons.SUCCESS);
    //URL imageUrl = new URL("/fi/helsinki/cs/tmc/intellij/smile.gif");
    //ImageIcon icon = new ImageIcon(getClass().getResource("/smiley.gif"));
    //yayLabel.setIcon(icon);
    //new ImageIcon(getClass().getResource("/fi/helsinki/cs/tmc/smile.gif"));
    //yayLabel.setIcon(ConvenientDialogDisplayer.getDefault().getSmileyIcon());

    getContentPane().add(leftAligned(yayLabel));
}
项目:intellij-ce-playground    文件:JavaMethodNode.java   
@Override
protected void customizeRendererText(ColoredTreeCellRenderer renderer) {
  final StringBuilder buffer = new StringBuilder(128);
  final PsiClass containingClass = myMethod.getContainingClass();
  if (containingClass != null) {
    buffer.append(ClassPresentationUtil.getNameForClass(containingClass, false));
    buffer.append('.');
  }
  final String methodText = PsiFormatUtil.formatMethod(
    myMethod,
    PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
    PsiFormatUtil.SHOW_TYPE
  );
  buffer.append(methodText);

  final SimpleTextAttributes attributes = isEnabled() ?
                                          new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground()) :
                                          SimpleTextAttributes.EXCLUDED_ATTRIBUTES;
  renderer.append(buffer.toString(), attributes);

  if (containingClass != null) {
    final String packageName = getPackageName(containingClass);
    renderer.append("  (" + packageName + ")", new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, JBColor.GRAY));
  }
}
项目:intellij-ce-playground    文件:OutOfMemoryDialog.java   
private static void configControls(String optionName,
                                   int value,
                                   boolean highlight,
                                   JLabel sizeLabel,
                                   JTextField sizeField,
                                   JLabel unitsLabel,
                                   JLabel currentValueLabel) {
  sizeLabel.setText(optionName);

  String formatted = value == -1 ? DiagnosticBundle.message("diagnostic.out.of.memory.currentValue.unknown") : String.valueOf(value);
  sizeField.setText(formatted);
  currentValueLabel.setText(DiagnosticBundle.message("diagnostic.out.of.memory.currentValue", formatted));

  if (highlight) {
    sizeLabel.setForeground(JBColor.RED);
    sizeField.setForeground(JBColor.RED);
    unitsLabel.setForeground(JBColor.RED);
    currentValueLabel.setForeground(JBColor.RED);
  }
}
项目:intellij-ce-playground    文件:ChooseDeviceDefinitionStep.java   
public ChooseDeviceDefinitionStep(@Nullable Disposable parentDisposable) {
  super(parentDisposable);
  setBodyComponent(myPanel);
  myDeviceDefinitionList.addSelectionListener(new DeviceDefinitionList.DeviceDefinitionSelectionListener() {
    @Override
    public void onDeviceSelectionChanged(@Nullable Device selectedDevice) {
      myDeviceDefinitionPreview.setDevice(selectedDevice);
      myState.put(DEVICE_DEFINITION_KEY, selectedDevice);
      updateEditButton(selectedDevice);
    }
  });
  myDeviceDefinitionList.addCategoryListener(myDeviceDefinitionPreview);
  myEditButtonContainer.setBackground(JBColor.background());
  myEditDeviceButton.setBackground(JBColor.background());
  myDeviceDefinitionList.setBorder(BorderFactory.createLineBorder(JBColor.lightGray));
  updateEditButton(null);
}
项目: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    文件:PasswordSafeOptionsPanel.java   
/**
 * The constructor
 *
 * @param passwordSafe the password safe service instance
 */
public PasswordSafeOptionsPanel(PasswordSafe passwordSafe) {
  myPasswordSafe = (PasswordSafeImpl)passwordSafe;
  myMasterPasswordStateLabel.setForeground(JBColor.BLUE);
  updateMasterPasswordState();
  myManagePasswordButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (myPasswordSafe.getMasterKeyProvider().isEmpty()) {
        MasterPasswordDialog.resetMasterPasswordDialog(null, myPasswordSafe.getMasterKeyProvider(), PasswordSafeOptionsPanel.class).show();
      }
      else {
        MasterPasswordDialog.changeMasterPasswordDialog(null, myPasswordSafe.getMasterKeyProvider(), PasswordSafeOptionsPanel.class).show();
      }
      updateMasterPasswordState();
    }
  });
}
项目:intellij-ce-playground    文件:EduAnswerPlaceholderPainter.java   
public static void drawAnswerPlaceholder(@NotNull final Editor editor, @NotNull final AnswerPlaceholder placeholder,
                                         boolean useLength, @NotNull final JBColor color) {
  final Document document = editor.getDocument();
  if (useLength && !placeholder.isValid(document)) {
    return;
  }
  EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  final TextAttributes textAttributes = new TextAttributes(scheme.getDefaultForeground(), scheme.getDefaultBackground(), null,
                                                                  EffectType.BOXED, Font.PLAIN);
  final Project project = editor.getProject();
  assert project != null;
  final int startOffset = placeholder.getRealStartOffset(document);
  final int length = placeholder.getLength();
  final int replacementLength = placeholder.getPossibleAnswerLength();
  int highlighterLength = useLength ? length : replacementLength;
  final int endOffset = startOffset + highlighterLength;
  textAttributes.setEffectColor(color);
  RangeHighlighter
    highlighter = editor.getMarkupModel().addRangeHighlighter(startOffset, endOffset, PLACEHOLDERS_LAYER,
                                                              textAttributes, HighlighterTargetArea.EXACT_RANGE);
  highlighter.setGreedyToLeft(true);
  highlighter.setGreedyToRight(true);
}
项目:intellij-ce-playground    文件:DetailsPanel.java   
private void updateDetailsBorder(@Nullable VcsFullCommitDetails data) {
  if (data == null || !myColorManager.isMultipleRoots()) {
    myMainContentPanel.setBorder(BorderFactory.createEmptyBorder());
  }
  else {
    Color color = VcsLogGraphTable.getRootBackgroundColor(data.getRoot(), myColorManager);
    myMainContentPanel.setBorder(new CompoundBorder(new MatteBorder(0, VcsLogGraphTable.ROOT_INDICATOR_COLORED_WIDTH, 0, 0, color),
                                                    new MatteBorder(0, VcsLogGraphTable.ROOT_INDICATOR_WHITE_WIDTH, 0, 0,
                                                                    new JBColor(new NotNullProducer<Color>() {
                                                                      @NotNull
                                                                      @Override
                                                                      public Color produce() {
                                                                        return getDetailsBackground();
                                                                      }
                                                                    }))));
  }
}
项目:intellij-ce-playground    文件:NotificationMessageElement.java   
protected void updateStyle(@NotNull JEditorPane editorPane, @Nullable JTree tree, Object value, boolean selected, boolean hasFocus) {
  final HTMLDocument htmlDocument = (HTMLDocument)editorPane.getDocument();
  final Style style = htmlDocument.getStyleSheet().getStyle(MSG_STYLE);
  if (value instanceof LoadingNode) {
    StyleConstants.setForeground(style, JBColor.GRAY);
  }
  else {
    if (selected) {
      StyleConstants.setForeground(style, hasFocus ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeTextForeground());
    }
    else {
      StyleConstants.setForeground(style, UIUtil.getTreeTextForeground());
    }
  }

  if (UIUtil.isUnderGTKLookAndFeel() ||
      UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus ||
      tree != null && tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
    editorPane.setOpaque(false);
  }
  else {
    editorPane.setOpaque(selected && hasFocus);
  }

  htmlDocument.setCharacterAttributes(0, htmlDocument.getLength(), style, false);
}
项目:intellij-ce-playground    文件:FileColorManagerImpl.java   
@Override
@SuppressWarnings({"MethodMayBeStatic"})
@Nullable
public Color getColor(@NotNull final String name) {
  Color color = ourDefaultColors.get(name);
  if (color != null) {
    return color;
  }

  if ("ffffe4".equals(name) || "494539".equals(name)) {
    return new JBColor(0xffffe4, 0x494539);
  }

  if ("e7fadb".equals(name) || "2a3b2c".equals(name)) {
    return new JBColor(0xe7fadb, 0x2a3b2c);
  }

  return ColorUtil.fromHex(name, 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    文件:DiffPanelImpl.java   
static JComponent createComponentForTitle(@Nullable String title,
                                          @Nullable final LineSeparator sep1,
                                          @Nullable final LineSeparator sep2,
                                          boolean left) {
  if (sep1 != null && sep2 != null && !sep1.equals(sep2)) {
    LineSeparator separator = left ? sep1 : sep2;
    JPanel bottomPanel = new JPanel(new BorderLayout());
    JLabel sepLabel = new JLabel(separator.name());
    sepLabel.setForeground(separator.equals(LineSeparator.CRLF) ? JBColor.RED : PlatformColors.BLUE);
    bottomPanel.add(sepLabel, left ? BorderLayout.EAST : BorderLayout.WEST);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JLabel(title == null ? "" : title));
    panel.add(bottomPanel, BorderLayout.SOUTH);
    return panel;
  }
  else {
    return new JBLabel(title == null ? "" : title);
  }
}
项目: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    文件:HprofViewPanel.java   
@NotNull
public static JBSplitter createNavigationSplitter(@Nullable JComponent leftPanelContents, @Nullable JComponent rightPanelContents) {
  JBPanel navigationPanel = new JBPanel(new BorderLayout());
  navigationPanel.setBackground(JBColor.background());
  if (leftPanelContents != null) {
    navigationPanel.add(leftPanelContents, BorderLayout.CENTER);
  }

  JBPanel contextInformationPanel = new JBPanel(new BorderLayout());
  contextInformationPanel.setBackground(JBColor.background());
  if (rightPanelContents != null) {
    contextInformationPanel.add(rightPanelContents, BorderLayout.CENTER);
  }

  JBSplitter navigationSplitter = new JBSplitter(false);
  navigationSplitter.setFirstComponent(navigationPanel);
  navigationSplitter.setSecondComponent(contextInformationPanel);
  navigationSplitter.setDividerWidth(DIVIDER_WIDTH);

  return navigationSplitter;
}
项目:intellij-ce-playground    文件:StudyDirectoryNode.java   
private void setStudyAttributes(Lesson lesson, PresentationData data, String additionalName) {
  StudyStatus taskStatus = StudyTaskManager.getInstance(myProject).getStatus(lesson);
  switch (taskStatus) {
    case Unchecked: {
      updatePresentation(data, additionalName, JBColor.BLACK, EducationalIcons.Lesson);
      break;
    }
    case Solved: {
      updatePresentation(data, additionalName, new JBColor(new Color(0, 134, 0), new Color(98, 150, 85)), InteractiveLearningIcons.LessonCompl);
      break;
    }
    case Failed: {
      updatePresentation(data, additionalName, JBColor.RED, EducationalIcons.Lesson);
    }
  }
}
项目:IdeaCurrency    文件:IdeaCurrencyToolWindow.java   
@Override
public void init(ToolWindow window) {
    myExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setDaemon(true).setNameFormat("DataFetch-%s").build());
    table.setDragEnabled(false);
    defaultTableModel = prepareTableHeader();
    reloadButton.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scheduleTask(IdeaCurrencyConfig.getInstance().getReloadInterval());
        }
    });
    contentPane.setBackground(JBColor.LIGHT_GRAY);
    table.getEmptyText().setText(TABLE_EMPTY_TEXT);
    scheduleNextTask();
}
项目:reasonml-idea-plugin    文件:RmlEditorLinePainter.java   
private static TextAttributes getNormalAttributes() {
    TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES);
    if (attributes == null || attributes.getForegroundColor() == null) {
        return new TextAttributes(new JBColor(Gray._135, new Color(0x3d8065)), null, null, null, Font.ITALIC);
    }
    return attributes;
}
项目:GoogleTranslation    文件:RequestRunnable.java   
private void showPopupBalloon(final String result) {
    ApplicationManager.getApplication().invokeLater(() -> {
        mEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);//解决因为TranslationPlugin而导致的泡泡显示错位问题
        JBPopupFactory factory = JBPopupFactory.getInstance();
        factory.createHtmlTextBalloonBuilder(result, null, new JBColor(Gray._242, Gray._0), null)
                .createBalloon()
                .show(factory.guessBestPopupLocation(mEditor), Balloon.Position.below);
    });
}
项目:mvp-code-creator    文件:CreatorAction.java   
private void showPopupBalloon(final Editor editor, final String result) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        public void run() {
            JBPopupFactory factory = JBPopupFactory.getInstance();
            factory.createHtmlTextBalloonBuilder(result, null, new JBColor(new Color(186, 238, 186), new Color(73, 117, 73)), null)
                    .setFadeoutTime(5000)
                    .createBalloon()
                    .show(factory.guessBestPopupLocation(editor), Balloon.Position.below);
        }
    });
}
项目:hybris-integration-intellij-idea-plugin    文件:BpDiagramColorManagerIml.java   
@Override
public Color getEdgeColor(final DiagramEdge edge) {
    final String edgeType = edge.getRelationship().toString();

    if (StringUtils.isBlank(edgeType) || "OK".equalsIgnoreCase(edgeType)) {
        return new JBColor(
            new Color(9, 128, 0),
            new Color(9, 128, 0)
        );
    }

    if ("NOK".equalsIgnoreCase(edgeType) || "ERROR".equalsIgnoreCase(edgeType) || "FAIL".equalsIgnoreCase(edgeType)) {
        return new JBColor(
            new Color(161, 49, 42),
            new Color(161, 49, 42)
        );
    }

    final String timeoutLabel = HybrisI18NBundleUtils.message("hybris.business.process.timeout");

    if (StringUtils.startsWith(edgeType, timeoutLabel)) {
        return new JBColor(
            new Color(161, 49, 42),
            new Color(161, 49, 42)
        );
    }

    return new JBColor(
        new Color(71, 71, 71),
        new Color(155, 158, 161)
    );
}
项目:IntelliJ-Key-Promoter-X    文件:SuppressedList.java   
@Override
public Component getListCellRendererComponent(JList<? extends StatisticsItem> list, StatisticsItem value, int index, boolean isSelected, boolean cellHasFocus) {
    final Color foreground = list.getForeground();
    final Color background = list.getBackground();
    final String message = KeyPromoterBundle.message(
            "kp.list.suppressed.item",
            value.getShortcut(),
            value.description
    );
    if (isSelected) {
        setBackground(JBColor.GRAY);
    } else {
        setBackground(background);
    }

    setText(message);
    setForeground(foreground);
    setBorder(new EmptyBorder(2, 10, 2, 10));
    if (value.ideaActionID != null && !"".equals(value.ideaActionID)) {
        final AnAction action = ActionManager.getInstance().getAction(value.ideaActionID);

        if (action != null) {
            final Icon icon = action.getTemplatePresentation().getIcon();
            if (icon != null) {
                setIcon(icon);
            }
        }
    }
    return this;
}
项目:educational-plugin    文件:StepicAdaptiveReactionsPanel.java   
@Override
public void mouseEntered(MouseEvent e) {
  final com.jetbrains.edu.learning.courseFormat.tasks.Task task = StudyUtils.getCurrentTask(myProject);
  if (task != null && task.getStatus() != StudyStatus.Solved && myPanel.isEnabled()) {
    setBackground(JBColor.GRAY);
  }
}
项目:educational-plugin    文件:CCCreateAnswerPlaceholderPanel.java   
public CCCreateAnswerPlaceholderPanel(@Nullable String placeholderText, @NotNull List<String> hints) {
  if (hints.isEmpty()) {
    myHints.add(HINT_PLACEHOLDER);
  }
  else {
    myHints.addAll(hints);
  }

  myPlaceholderTextArea.setBorder(BorderFactory.createLineBorder(JBColor.border()));
  myPlaceholderTextArea.setText(placeholderText);
  myPlaceholderTextArea.addFocusListener(new FocusAdapter() {
    @Override
    public void focusGained(FocusEvent e) {
      myPlaceholderTextArea.selectAll();
    }
  });
  myPlaceholderTextArea.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
  myPlaceholderTextArea.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);

  myHintsPanel.setBorder(BorderFactory.createLineBorder(JBColor.border()));
  ((GridLayoutManager)myHintsPanel.getLayout()).setHGap(1);

  myHintTextArea.setFont(UIUtil.getLabelFont());
  myPlaceholderTextArea.setFont(UIUtil.getLabelFont());
  myHintTextArea.addFocusListener(createFocusListenerToSetDefaultHintText());

  actionsPanel.add(createHintToolbarComponent(), BorderLayout.WEST);
  showHint();
}
项目:educational-plugin    文件:StudyDirectoryNode.java   
protected static void updatePresentation(PresentationData data, String name, JBColor color, Icon icon, @Nullable String additionalInfo) {
  data.clearText();
  data.addText(name, new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, color));
  if (additionalInfo != null) {
    data.addText(" (" + additionalInfo + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }
  data.setIcon(icon);
}
项目:educational-plugin    文件:TaskDirectoryNode.java   
@Override
protected void updateImpl(PresentationData data) {
  StudyStatus status = myTask.getStatus();
  String subtaskInfo = myTask instanceof TaskWithSubtasks ? getSubtaskInfo((TaskWithSubtasks)myTask) : null;
  if (status == StudyStatus.Unchecked) {
    updatePresentation(data, myTask.getName(), JBColor.BLACK, EducationalCoreIcons.Task, subtaskInfo);
    return;
  }
  boolean isSolved = status == StudyStatus.Solved;
  JBColor color = isSolved ? LIGHT_GREEN : JBColor.RED;
  Icon icon = isSolved ? EducationalCoreIcons.TaskCompl : EducationalCoreIcons.TaskProbl;
  updatePresentation(data, myTask.getName(), color, icon, subtaskInfo);
}
项目:educational-plugin    文件:LessonDirectoryNode.java   
@Override
protected void updateImpl(PresentationData data) {
  StudyStatus status = myLesson.getStatus();
  boolean isSolved = status != StudyStatus.Solved;
  JBColor color = isSolved ? JBColor.BLACK : LIGHT_GREEN;
  Icon icon = isSolved ? EducationalCoreIcons.Lesson : EducationalCoreIcons.LessonCompl;
  updatePresentation(data, myLesson.getName(), color, icon, null);
}
项目:educational-plugin    文件:StudyTaskManager.java   
public JBColor getColor(@NotNull final AnswerPlaceholder placeholder) {
  if (!placeholder.getUseLength() && placeholder.isActive() && placeholder.getActiveSubtaskInfo().isNeedInsertText()) {
    return JBColor.LIGHT_GRAY;
  }
  final StudyStatus status = placeholder.getStatus();
  if (status == StudyStatus.Solved) {
    return JBColor.GREEN;
  }
  if (status == StudyStatus.Failed) {
    return JBColor.RED;
  }
  return JBColor.BLUE;
}
项目:educational-plugin    文件:CCShowPreview.java   
private static void showPreviewDialog(@NotNull Project project, @NotNull TaskFile taskFile) {
  final FrameWrapper showPreviewFrame = new FrameWrapper(project);
  final LightVirtualFile userFile = new LightVirtualFile(taskFile.name, taskFile.text);
  showPreviewFrame.setTitle(userFile.getName());
  LabeledEditor labeledEditor = new LabeledEditor(null);
  final EditorFactory factory = EditorFactory.getInstance();
  Document document = FileDocumentManager.getInstance().getDocument(userFile);
  if (document == null) {
    return;
  }
  final EditorEx createdEditor = (EditorEx)factory.createEditor(document, project, userFile, true);
  Disposer.register(project, () -> factory.releaseEditor(createdEditor));
  for (AnswerPlaceholder answerPlaceholder : taskFile.getActivePlaceholders()) {
    if (answerPlaceholder.getActiveSubtaskInfo().isNeedInsertText()) {
      answerPlaceholder.setLength(answerPlaceholder.getTaskText().length());
    }
    Integer minIndex = Collections.min(answerPlaceholder.getSubtaskInfos().keySet());
    answerPlaceholder.setUseLength(minIndex >= answerPlaceholder.getActiveSubtaskIndex());
    EduAnswerPlaceholderPainter.drawAnswerPlaceholder(createdEditor, answerPlaceholder, JBColor.BLUE);
  }
  JPanel header = new JPanel();
  header.setLayout(new BoxLayout(header, BoxLayout.Y_AXIS));
  header.setBorder(new EmptyBorder(10, 10, 10, 10));
  header.add(new JLabel("Read-only preview."));
  String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(Calendar.getInstance().getTime());
  header.add(new JLabel(String.format("Created %s.", timeStamp)));
  JComponent editorComponent = createdEditor.getComponent();
  labeledEditor.setComponent(editorComponent, header);
  createdEditor.setCaretVisible(false);
  createdEditor.setCaretEnabled(false);
  showPreviewFrame.setComponent(labeledEditor);
  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    showPreviewFrame.setSize(new Dimension(500, 500));
    showPreviewFrame.show();
  }
}