From 136bb52aaef233a6d343c2845419c73e85d24180 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 26 Sep 2016 15:58:08 +0300 Subject: [PATCH] IDEA-161384 ui: fix text alignment in ComboBoxAction under HiDPI --- .../com/intellij/openapi/actionSystem/ex/ComboBoxAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java index 4e75d95be700..00cc272c88ea 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ComboBoxAction.java @@ -415,7 +415,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent final Font font = getFont(); g.setFont(font); g.setColor(textColor); - g.drawString(getText(), x, (size.height + font.getSize()) / 2 - 1); + UIUtil.drawCenteredString((Graphics2D)g, new Rectangle(x, 0, Integer.MAX_VALUE, size.height), getText(), false, true); } } else { @@ -454,7 +454,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent final Font font = getFont(); g2.setFont(font); g2.setColor(textColor); - g2.drawString(getText(), x, (size.height + font.getSize()) / 2 - 1); + UIUtil.drawCenteredString(g2, new Rectangle(x, 0, Integer.MAX_VALUE, size.height), getText(), false, true); } } else {