From 9a7907870f97cd0a13766bcd3a5a255a2ba81f1e Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Fri, 27 Jan 2006 10:19:59 +0000 Subject: 2006-01-27 Roman Kennke * javax/swing/SwingUtilities.java (calculateInsetArea): Removed unneeded method. The method calculateInnerArea has the same purpose and is actually specified. (calculateInnerArea): Rewritten to not use calculateInsetArea. * javax/swing/plaf/basic/BasicMenuItemUI.java (paintMenuItem): Use SwingUtilities.calculateInnerArea() instead of SwingUtilities.calculateInsetArea(). --- ChangeLog | 10 ++++++++ javax/swing/SwingUtilities.java | 36 +++++++---------------------- javax/swing/plaf/basic/BasicMenuItemUI.java | 3 +-- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00ff21445..8392bb444 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-01-27 Roman Kennke + + * javax/swing/SwingUtilities.java + (calculateInsetArea): Removed unneeded method. The method + calculateInnerArea has the same purpose and is actually specified. + (calculateInnerArea): Rewritten to not use calculateInsetArea. + * javax/swing/plaf/basic/BasicMenuItemUI.java + (paintMenuItem): Use SwingUtilities.calculateInnerArea() instead + of SwingUtilities.calculateInsetArea(). + 2006-01-27 Roman Kennke * javax/swing/plaf/basic/BasicTreeUI.java diff --git a/javax/swing/SwingUtilities.java b/javax/swing/SwingUtilities.java index af4ae040a..811f1d6c4 100644 --- a/javax/swing/SwingUtilities.java +++ b/javax/swing/SwingUtilities.java @@ -83,31 +83,6 @@ public class SwingUtilities { // Do nothing. } - - /** - * Calculates the portion of the base rectangle which is inside the - * insets. - * - * @param base The rectangle to apply the insets to - * @param insets The insets to apply to the base rectangle - * @param ret A rectangle to use for storing the return value, or - * null - * - * @return The calculated area inside the base rectangle and its insets, - * either stored in ret or a new Rectangle if ret is null - * - * @see #calculateInnerArea - */ - public static Rectangle calculateInsetArea(Rectangle base, Insets insets, - Rectangle ret) - { - if (ret == null) - ret = new Rectangle(); - ret.setBounds(base.x + insets.left, base.y + insets.top, - base.width - (insets.left + insets.right), - base.height - (insets.top + insets.bottom)); - return ret; - } /** * Calculates the portion of the component's bounds which is inside the @@ -122,13 +97,18 @@ public class SwingUtilities * * @return The calculated area inside the component and its border * insets - * - * @see #calculateInsetArea */ public static Rectangle calculateInnerArea(JComponent c, Rectangle r) { Rectangle b = getLocalBounds(c); - return calculateInsetArea(b, c.getInsets(), r); + if (r == null) + r = new Rectangle(); + Insets i = c.getInsets(); + r.x = b.x + i.left; + r.width = b.width - i.left - i.right; + r.y = b.y + i.top; + r.height = b.height - i.top - i.bottom; + return r; } /** diff --git a/javax/swing/plaf/basic/BasicMenuItemUI.java b/javax/swing/plaf/basic/BasicMenuItemUI.java index 63f0ce206..9166c49ee 100644 --- a/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -610,8 +610,7 @@ public class BasicMenuItemUI extends MenuItemUI Font f = m.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); - SwingUtilities.calculateInnerArea(m, br); - SwingUtilities.calculateInsetArea(br, m.getInsets(), vr); + SwingUtilities.calculateInnerArea(m, vr); paintBackground(g, m, background); /* -- cgit v1.2.1