OSDN Git Service

initial commit
[xdf/git-repos.git] / xdf-swing / src / main / java / jp / ac / aiit / xdf / component / swing / attribute / IconProcessor.java
1 package jp.ac.aiit.xdf.component.swing.attribute;
2
3 import javax.swing.ImageIcon;
4
5 import jp.ac.aiit.xdf.utils.Reflections;
6
7 /**
8  * @author kodama
9  */
10 public class IconProcessor implements AttributeSetProcessor {
11
12         @Override
13         public void invokeSet(Object target, String name, Object value) {
14                 try{
15                         Reflections.invokeMethod(
16                                 target
17                                 , "setIcon"
18                                 , new ImageIcon(ClassLoader.getSystemResource((String)value))
19                         );
20                 } catch(NoSuchMethodException me){
21                         me.printStackTrace();
22                 } catch(Exception e){
23                         e.printStackTrace();
24                 }
25         }
26 }