本文整理汇总了Java中com.intellij.ui.JBColor类的典型用法代码示例。如果您正苦于以下问题:Java JBColor类的具体用法?Java JBColor怎么用?Java JBColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JBColor类属于com.intellij.ui包,在下文中一共展示了JBColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintComponent
import com.intellij.ui.JBColor; //导入依赖的package包/类
@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);
}
}
示例2: customizeCellRenderer
import com.intellij.ui.JBColor; //导入依赖的package包/类
@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);
}
示例3: drawAllAnswerPlaceholders
import com.intellij.ui.JBColor; //导入依赖的package包/类
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);
}
示例4: createCourseProgress
import com.intellij.ui.JBColor; //导入依赖的package包/类
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;
}
示例5: drawAnswerPlaceholder
import com.intellij.ui.JBColor; //导入依赖的package包/类
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);
}
}
示例6: refreshPdeFileImportPreview
import com.intellij.ui.JBColor; //导入依赖的package包/类
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);
}
}
示例7: getTableCellRendererComponent
import com.intellij.ui.JBColor; //导入依赖的package包/类
@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;
}
示例8: update
import com.intellij.ui.JBColor; //导入依赖的package包/类
@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);
}
}
示例9: CpuMonitorView
import com.intellij.ui.JBColor; //导入依赖的package包/类
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);
}
示例10: createUIComponents
import com.intellij.ui.JBColor; //导入依赖的package包/类
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")));
}
示例11: SwaggerUIViewer
import com.intellij.ui.JBColor; //导入依赖的package包/类
public SwaggerUIViewer() {
super(new BorderLayout());
this.setBackground(JBColor.background());
this.setVisible(false);
Platform.setImplicitExit(false);
ApplicationManager
.getApplication()
.invokeLater(() -> PlatformImpl.startup(this::createWebView));
}
示例12: addYayLabel
import com.intellij.ui.JBColor; //导入依赖的package包/类
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));
}
示例13: customizeRendererText
import com.intellij.ui.JBColor; //导入依赖的package包/类
@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));
}
}
示例14: configControls
import com.intellij.ui.JBColor; //导入依赖的package包/类
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);
}
}
示例15: ChooseDeviceDefinitionStep
import com.intellij.ui.JBColor; //导入依赖的package包/类
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);
}