jdk/src/share/classes/javax/swing/plaf/synth/SynthArrowButton.java
changeset 2658 43e06bc950ec
parent 715 f16baef3a20e
child 5506 202f599c92aa
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthArrowButton.java	Fri Apr 17 16:28:02 2009 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthArrowButton.java	Sat Apr 25 21:17:50 2009 +0400
@@ -113,6 +113,31 @@
                     context.getStyle().getInt(context, "ArrowButton.size", 16);
                 dim = new Dimension(size, size);
             }
+
+            // handle scaling for sizeVarients for special case components. The
+            // key "JComponent.sizeVariant" scales for large/small/mini
+            // components are based on Apples LAF
+            Container parent = context.getComponent().getParent();
+            if (parent instanceof JComponent && !(parent instanceof JComboBox)) {
+                Object scaleKey = ((JComponent)parent).
+                                    getClientProperty("JComponent.sizeVariant");
+                if (scaleKey != null){
+                    if ("large".equals(scaleKey)){
+                        dim = new Dimension(
+                                (int)(dim.width * 1.15),
+                                (int)(dim.height * 1.15));
+                    } else if ("small".equals(scaleKey)){
+                        dim = new Dimension(
+                                (int)(dim.width * 0.857),
+                                (int)(dim.height * 0.857));
+                    } else if ("mini".equals(scaleKey)){
+                        dim = new Dimension(
+                                (int)(dim.width * 0.714),
+                                (int)(dim.height * 0.714));
+                    }
+                }
+            }
+
             context.dispose();
             return dim;
         }