OSDN Git Service

initial commit
[xdf/git-repos.git] / xdf-swing / src / main / java / jp / ac / aiit / xdf / component / swing / attribute / BgcolorProcessor.java
1 package jp.ac.aiit.xdf.component.swing.attribute;
2
3 import javax.swing.JComponent;
4
5 /**
6  * bgcolor属性の為のAttributeProcessor。
7  * @author kodama
8  */
9 public class BgcolorProcessor extends SetterAttributeProcessor{
10
11         /**
12          * コンストラクター
13          */
14         public BgcolorProcessor(){
15                 super("setBackground", false);
16         }
17
18         @Override
19         public void invokeSet(Object target, String name, Object value) {
20                 //まず、強制的に不透明化する。
21                 try{
22 //                      Reflections.invokeMethod(target, "setOpaque", true);
23                         //└→ これは setOpaque(Boolean) と解されて NoSuchMethodException。
24                         ((JComponent)target).setOpaque(true);
25                 } catch(Exception e){
26                         e.printStackTrace();
27                 }
28                 super.invokeSet(target, name, value);
29         }
30         
31 }