diff options
Diffstat (limited to 'libjava/classpath/javax/swing/SwingUtilities.java')
-rw-r--r-- | libjava/classpath/javax/swing/SwingUtilities.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libjava/classpath/javax/swing/SwingUtilities.java b/libjava/classpath/javax/swing/SwingUtilities.java index ee5fa74d47a..58b3a78d7aa 100644 --- a/libjava/classpath/javax/swing/SwingUtilities.java +++ b/libjava/classpath/javax/swing/SwingUtilities.java @@ -840,7 +840,7 @@ public class SwingUtilities iconR.width = icon.getIconWidth(); iconR.height = icon.getIconHeight(); } - if (text == null) + if (text == null || text.equals("")) { textIconGap = 0; textR.width = 0; @@ -890,7 +890,7 @@ public class SwingUtilities iconR.y = 0; textR.y = (horizontalTextPosition == CENTER ? iconR.height + textIconGap - : iconR.height - textR.height); + : Math.max(iconR.height - textR.height, 0)); break; case CENTER: int centerLine = Math.max(textR.height, iconR.height) / 2; @@ -1116,7 +1116,7 @@ public class SwingUtilities * <pre> * [{@link javax.swing.JComponent#getActionMap()}] * --> [{@link javax.swing.ActionMap}] - * parent --> [{@link javax.swing.text.KeymapActionMap}] + * parent --> [{@link javax.swing.text.JTextComponent.KeymapActionMap}] * parent --> [{@link javax.swing.plaf.ActionMapUIResource}] * </pre> * @@ -1138,14 +1138,12 @@ public class SwingUtilities else { ActionMap parent = child.getParent(); - while(parent != null) + while (parent != null && !(parent instanceof ActionMapUIResource)) { child = parent; parent = child.getParent(); } - - if (child != null) - child.setParent(uiActionMap); + child.setParent(uiActionMap); } } @@ -1159,7 +1157,7 @@ public class SwingUtilities * <pre> * [{@link javax.swing.JComponent#getInputMap()}] * --> [{@link javax.swing.InputMap}] - * parent --> [{@link javax.swing.text.KeymapWrapper}] + * parent --> [{@link javax.swing.text.JTextComponent.KeymapWrapper}] * parent --> [{@link javax.swing.plaf.InputMapUIResource}] * </pre> * @@ -1181,11 +1179,13 @@ public class SwingUtilities component.setInputMap(condition, uiInputMap); else { - while(child.getParent() != null - && !(child.getParent() instanceof InputMapUIResource)) - child = child.getParent(); - if (child != null) - child.setParent(uiInputMap); + InputMap parent = child.getParent(); + while (parent != null && !(parent instanceof InputMapUIResource)) + { + child = parent; + parent = parent.getParent(); + } + child.setParent(uiInputMap); } } |