Java Code Examples for com.intellij.ui.JBColor#foreground()
The following examples show how to use
com.intellij.ui.JBColor#foreground() .
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: FileColorConfigurationEditDialog.java From consulo with Apache License 2.0 | 5 votes |
@Override public Color getForeground() { if (getModel().isSelected()) { return JBColor.foreground(); } else if (getModel().isRollover()) { return JBColor.GRAY; } else { return getColor(); } }
Example 2
Source File: TimeTrackerWidget.java From DarkyenusTimeTracker with The Unlicense | 4 votes |
@Override public void paintComponent(final Graphics g) { final int timeToShow = service.getTotalTimeSeconds(); final String info = currentShowTimePattern().secondsToString(timeToShow); final Dimension size = getSize(); final Insets insets = getInsets(); final int totalBarLength = size.width - insets.left - insets.right; final int barHeight = Math.max(size.height, getFont().getSize() + 2); final int yOffset = (size.height - barHeight) / 2; final int xOffset = insets.left; final TimeTrackingStatus status = service.getStatus(); if (mouseInside) { if (status == RUNNING) { g.setColor(COLOR_MENU_ON); } else { g.setColor(COLOR_MENU_OFF); } } else { switch (status) { case RUNNING: g.setColor(COLOR_ON); break; case IDLE: g.setColor(COLOR_IDLE); break; case STOPPED: g.setColor(COLOR_OFF); break; } } g.fillRect(insets.left, insets.bottom, totalBarLength, size.height - insets.bottom - insets.top); UISettings.setupAntialiasing(g); if (mouseInside) { // Draw controls g.setColor(JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground()); final int resumeStopWidth = resumeStopButtonWidth(totalBarLength); final int settingsWidth = totalBarLength - resumeStopWidth; g.drawLine(xOffset + resumeStopWidth, yOffset, xOffset + resumeStopWidth, yOffset + barHeight); Icon firstIcon = status == RUNNING ? STOP_ICON : START_ICON; firstIcon.paintIcon(this, g, xOffset + (resumeStopWidth - firstIcon.getIconWidth()) / 2, yOffset + (barHeight - firstIcon.getIconHeight())/2); SETTINGS_ICON.paintIcon(this, g, xOffset + resumeStopWidth + (settingsWidth - SETTINGS_ICON.getIconWidth()) / 2, yOffset + (barHeight - SETTINGS_ICON.getIconHeight())/2); } else { // Draw time text final Color fg = getModel().isPressed() ? UIUtil.getLabelDisabledForeground() : JBColor.foreground(); g.setColor(fg); g.setFont(WIDGET_FONT); final FontMetrics fontMetrics = g.getFontMetrics(); final int infoWidth = fontMetrics.charsWidth(info.toCharArray(), 0, info.length()); final int infoHeight = fontMetrics.getAscent(); g.drawString(info, xOffset + (totalBarLength - infoWidth) / 2, yOffset + infoHeight + (barHeight - infoHeight) / 2 - 1); } }
Example 3
Source File: DependencyViewer.java From gradle-view with Apache License 2.0 | 4 votes |
public DependencyViewer(Project p, ToolWindow t) { super(true, true); this.project = p; this.toolWindow = t; this.splitter = new Splitter(false, 0.75f); this.information = new JTextArea(); this.toolingLogger = initToolingLogger(); this.dependencyCellRenderer = new DependencyCellRenderer(); this.dependencyCellRenderer.omittedSelected = JBColor.MAGENTA; this.dependencyCellRenderer.omittedUnselected = JBColor.GRAY; this.dependencyCellRenderer.normalSelected = JBColor.foreground(); this.dependencyCellRenderer.normalUnselected = JBColor.BLACK; this.information.setEditable(false); this.shouldPromptForCurrentProject = true; // TODO clean all of this up GradleService gradleService = ServiceManager.getService(project, GradleService.class); gradleService.addListener(new ViewActionListener() { @Override public void refresh() { // prompt only on first use of tool panel if (shouldPromptForCurrentProject) { // ask to initialize view for this project to the current project if (useCurrentProjectBuild()) { gradleBaseDir = project.getBasePath(); } shouldPromptForCurrentProject = false; } // there's nothing to do when there is no gradleBaseDir set, instead issue a prompt if(gradleBaseDir == null) { promptForGradleBaseDir(); } // initialize an empty view even if the gradleBaseDir is set while we load everything in the background updateView(null, null); new SwingWorker<GradleNode, Void>() { protected GradleNode doInBackground() throws Exception { try { Map<String, GradleNode> dependencyMap = loadProjectDependenciesFromModel(gradleBaseDir, toolingLogger); GradleNode rootDependency = dependencyMap.get("root"); GradleNode target = dependencyCellRenderer.selectedGradleNode; GradleNode selectedDependency; if(target != null && target.group != null) { selectedDependency = target; } else { selectedDependency = new GradleNode("No dependency selected"); } updateView(rootDependency, selectedDependency); return rootDependency; } catch(Exception e) { e.printStackTrace(); toolingLogger.log(ExceptionUtils.getFullStackTrace(e)); throw new RuntimeException(e); } } }.execute(); } @Override public void toggleShowReplaced() { dependencyCellRenderer.showReplaced = !dependencyCellRenderer.showReplaced; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { splitter.repaint(); splitter.validate(); } }); } @Override public void reset() { gradleBaseDir = null; refresh(); } }); gradleService.refresh(); setContent(splitter); final ActionManager actionManager = ActionManager.getInstance(); ActionToolbar actionToolbar = actionManager.createActionToolbar("Gradle View Toolbar", (DefaultActionGroup)actionManager.getAction("GradleView.NavigatorActionsToolbar"), true); actionToolbar.setTargetComponent(splitter); setToolbar(actionToolbar.getComponent()); }