jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
changeset 25087 dc3f3f90567f
parent 23010 6dadb192ad81
child 25159 fdacfe8fd602
equal deleted inserted replaced
24566:a43e10e7f3a6 25087:dc3f3f90567f
    29 import java.lang.reflect.Method;
    29 import java.lang.reflect.Method;
    30 import javax.swing.*;
    30 import javax.swing.*;
    31 import javax.swing.plaf.UIResource;
    31 import javax.swing.plaf.UIResource;
    32 import javax.swing.Painter;
    32 import javax.swing.Painter;
    33 import java.awt.print.PrinterGraphics;
    33 import java.awt.print.PrinterGraphics;
       
    34 import sun.reflect.misc.MethodUtil;
    34 
    35 
    35 /**
    36 /**
    36  * Convenient base class for defining Painter instances for rendering a
    37  * Convenient base class for defining Painter instances for rendering a
    37  * region or component in Nimbus.
    38  * region or component in Nimbus.
    38  *
    39  *
   443             } else if (c instanceof JTable && "selectionBackground".equals(property)) {
   444             } else if (c instanceof JTable && "selectionBackground".equals(property)) {
   444                 color = ((JTable) c).getSelectionBackground();
   445                 color = ((JTable) c).getSelectionBackground();
   445             } else {
   446             } else {
   446                 String s = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
   447                 String s = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
   447                 try {
   448                 try {
   448                     Method method = c.getClass().getMethod(s);
   449                     Method method = MethodUtil.getMethod(c.getClass(), s, null);
   449                     color = (Color) method.invoke(c);
   450                     color = (Color) MethodUtil.invoke(method, c, null);
   450                 } catch (Exception e) {
   451                 } catch (Exception e) {
   451                     //don't do anything, it just didn't work, that's all.
   452                     //don't do anything, it just didn't work, that's all.
   452                     //This could be a normal occurance if you use a property
   453                     //This could be a normal occurance if you use a property
   453                     //name referring to a key in clientProperties instead of
   454                     //name referring to a key in clientProperties instead of
   454                     //a real property
   455                     //a real property