changeset 4753:405ea1262453

7141281: [macosx] GridBagLayout baseline issue Reviewed-by: art
author alexp
date Wed, 08 Feb 2012 18:49:10 +0400
parents 08befe1a6658
children 7fecd78a4efb
files src/macosx/classes/com/apple/laf/AquaSpinnerUI.java
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/com/apple/laf/AquaSpinnerUI.java	Wed Feb 08 18:35:12 2012 +0400
+++ b/src/macosx/classes/com/apple/laf/AquaSpinnerUI.java	Wed Feb 08 18:49:10 2012 +0400
@@ -161,6 +161,33 @@
         return b;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int getBaseline(JComponent c, int width, int height) {
+        super.getBaseline(c, width, height);
+        JComponent editor = spinner.getEditor();
+        Insets insets = spinner.getInsets();
+        width = width - insets.left - insets.right;
+        height = height - insets.top - insets.bottom;
+        if (width >= 0 && height >= 0) {
+            int baseline = editor.getBaseline(width, height);
+            if (baseline >= 0) {
+                return insets.top + baseline;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Component.BaselineResizeBehavior getBaselineResizeBehavior(
+            JComponent c) {
+        super.getBaselineResizeBehavior(c);
+        return spinner.getEditor().getBaselineResizeBehavior();
+    }
+
     class TransparentButton extends JButton implements SwingConstants {
         boolean interceptRepaints = false;