01: package org.uispec4j;
02:
03: import org.uispec4j.utils.ComponentUtils;
04: import org.uispec4j.utils.Stringifier;
05:
06: import java.awt.Component;
07:
08: public class SwingComponentStringifier implements Stringifier {
09: private static final SwingComponentStringifier INSTANCE = new SwingComponentStringifier();
10:
11: private SwingComponentStringifier() {
12: }
13:
14: public String toString(Object obj) {
15: Component component = ((Component) obj);
16: return component.getClass().getName() + " ("
17: + ComponentUtils.getDisplayedName(component) + ")";
18: }
19:
20: public static Stringifier instance() {
21: return INSTANCE;
22: }
23: }
|