diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java index adf3812b3191..fd8a68555de8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java @@ -86,6 +86,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di textAndProgress.add(myText, BorderLayout.CENTER); final NonOpaquePanel progressWrapper = new NonOpaquePanel(new GridBagLayout()); + progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/TextPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/TextPanel.java index f70ddb2ba90f..83a400d1f9dd 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/TextPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/TextPanel.java @@ -58,7 +58,7 @@ public class TextPanel extends JComponent { @Override protected void paintComponent(final Graphics g) { - final String s = getText(); + String s = getText(); if (s != null) { final Rectangle bounds = getBounds(); final Insets insets = getInsets(); @@ -68,12 +68,28 @@ public class TextPanel extends JComponent { UIUtil.applyRenderingHints(g2); + final FontMetrics fm = g2.getFontMetrics(); + final int sWidth = fm.stringWidth(s); + int x = insets.left; if (myAlignment == JComponent.CENTER_ALIGNMENT || myAlignment == JComponent.RIGHT_ALIGNMENT) { - final int sWidth = g2.getFontMetrics().stringWidth(s); x = myAlignment == JComponent.CENTER_ALIGNMENT ? (bounds.width - sWidth) / 2 : bounds.width - insets.right - sWidth; } + final Rectangle textR = new Rectangle(); + final Rectangle iconR = new Rectangle(); + final Rectangle viewR = new Rectangle(bounds); + textR.x = textR.y = textR.width = textR.height = 0; + + viewR.width -= insets.left; + viewR.width -= insets.right; + + if (sWidth > (bounds.width - insets.left - insets.right)) { + s = SwingUtilities + .layoutCompoundLabel(fm, s, null, SwingUtilities.CENTER, SwingUtilities.CENTER, SwingUtilities.CENTER, SwingUtilities.TRAILING, + bounds, iconR, textR, 0); + } + final int y = UIUtil.getStringY(s, bounds, g2); if (SystemInfo.isMac && myDecorate) { g2.setColor(new Color(215, 215, 215));