From bf2a47e0ce21e18d7d8e8d2924b2003deacaf43a Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 25 Oct 2012 17:08:36 +0200 Subject: [PATCH] IDEA-93232 The notification balloon size should be correct always --- .../notification/impl/NotificationsManagerImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java index 33ee10cc5cbc..01d057056854 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java @@ -252,7 +252,7 @@ public class NotificationsManagerImpl extends NotificationsManager { text.setCaretPosition(0); JScrollPane pane = ScrollPaneFactory.createScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, - ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane.setBorder(null); pane.setOpaque(false); pane.getViewport().setOpaque(false); @@ -268,8 +268,10 @@ public class NotificationsManagerImpl extends NotificationsManager { text.setSize(preferredSize); preferredSize = text.getPreferredSize(); int maxHeight = Math.min(400, window.getComponent().getHeight() - 20); - if (preferredSize.height > maxHeight) { - pane.setPreferredSize(new Dimension(preferredSize.width, maxHeight)); + int maxWidth = Math.min(500, window.getComponent().getWidth() - 20); + Dimension maxSize = new Dimension(Math.min(preferredSize.width, maxWidth), Math.min(preferredSize.height, maxHeight)); + if (!maxSize.equals(preferredSize)) { + pane.setPreferredSize(maxSize); } final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(content);