diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestTreeView.java b/platform/testRunner/src/com/intellij/execution/testframework/TestTreeView.java index c429bce9253f..b61d1cfff362 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/TestTreeView.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/TestTreeView.java @@ -196,9 +196,8 @@ public abstract class TestTreeView extends Tree implements DataProvider, CopyPro final AbstractTestProxy testProxy = ((BaseTestProxyNodeDescriptor)data).getElement(); final String durationString = testProxy.getDurationString(); if (durationString != null) { - g.setColor(isRowSelected(row) ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeForeground()); - Rectangle fullRowRect = new Rectangle(visibleRect.x, rowBounds.y, visibleRect.width, rowBounds.height); - paintRowData(this, durationString, fullRowRect, (Graphics2D)g); + final Rectangle fullRowRect = new Rectangle(visibleRect.x, rowBounds.y, visibleRect.width, rowBounds.height); + paintRowData(this, durationString, fullRowRect, (Graphics2D)g, isRowSelected(row), hasFocus()); } } } @@ -207,14 +206,17 @@ public abstract class TestTreeView extends Tree implements DataProvider, CopyPro } } - private static void paintRowData(Tree tree, String duration, Rectangle bounds, Graphics2D g) { + private static void paintRowData(Tree tree, String duration, Rectangle bounds, Graphics2D g, boolean isSelected, boolean hasFocus) { final GraphicsConfig config = GraphicsUtil.setupAAPainting(g); final FontMetrics metrics = tree.getFontMetrics(tree.getFont()); g.setFont(metrics.getFont().deriveFont(Font.ITALIC, UIUtil.getFontSize(UIUtil.FontSize.MINI))); int totalWidth = metrics.stringWidth(duration); int x = bounds.x + bounds.width - totalWidth; + g.setColor(isSelected ? UIUtil.getTreeSelectionBackground(hasFocus) : UIUtil.getTreeBackground()); + g.fillRect(x, bounds.y, totalWidth, bounds.height); int fontHeight = (int)metrics.getMaxCharBounds(g).getHeight(); g.translate(0, bounds.y - 1); + g.setColor(isSelected ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeForeground()); g.drawString(duration, x, fontHeight); g.translate(0, -bounds.y + 1); config.restore();