Skip to content

Commit

Permalink
Use JBColor to ensure colours are correct with new UI (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
jshiell committed Apr 1, 2023
1 parent d5bd63f commit 6a0f0f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# CheckStyle-IDEA Changelog

* **5.77.1** Fixed: Colour mismatch in new UI (#608).
* **5.77.1** Fixed: Improved action update handling to reduce pauses (#601).
* **5.77.0** Fixed: Remove constructor injection from CheckerFactory for 2023.x compatibility (#604).
* **5.77.0** New: Now built against IDEA 2022.1.4 (was 2021.3.3).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.infernus.idea.checkstyle.toolwindow;

import com.intellij.ui.JBColor;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeCellRenderer;
Expand Down Expand Up @@ -33,7 +35,7 @@ public void paintComponent(final Graphics g) {
g.fillRect(offset, 0, getWidth() - 1 - offset, getHeight() - 1);

if (selected) {
g.setColor(UIManager.getColor("Tree.selectionBorderColor"));
g.setColor(JBColor.getColor("Tree.selectionBorderColor"));
g.drawRect(offset, 0, getWidth() - 1 - offset, getHeight() - 1);
}

Expand Down Expand Up @@ -73,10 +75,8 @@ public Component getTreeCellRendererComponent(final JTree tree,

setFont(tree.getFont());

setForeground(UIManager.getColor(selected
? "Tree.selectionForeground" : "Tree.textForeground"));
setBackground(UIManager.getColor(selected
? "Tree.selectionBackground" : "Tree.textBackground"));
setForeground(JBColor.getColor(selected ? "Tree.selectionForeground" : "Tree.textForeground"));
setBackground(JBColor.getColor(selected ? "Tree.selectionBackground" : "Tree.textBackground"));


return this;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<change-notes>
<![CDATA[
<ul>
<li>5.77.1: Fixed: Colour mismatch in new UI (#608).</li>
<li>5.77.1: Fixed: Improved action update handling to reduce pauses (#601).</li>
<li>5.77.0: Fixed: Remove constructor injection from CheckerFactory for 2023.x compatibility (#604).</li>
<li>5.77.0: New: Now built against IDEA 2022.1.4 (was 2021.3.3).</li>
Expand Down

0 comments on commit 6a0f0f7

Please sign in to comment.