01: /*
02: * Copyright 2006 Ethan Nicholas. All rights reserved.
03: * Use is subject to license terms.
04: */
05: package jaxx.types;
06:
07: import javax.swing.*;
08:
09: public class KeyStrokeConverter implements TypeConverter {
10: public String getJavaCode(Object object) {
11: return "KeyStroke.getKeyStroke(\"" + object.toString() + "\")";
12: }
13:
14: public Object convertFromString(String string, Class type) {
15: if (type != KeyStroke.class)
16: throw new IllegalArgumentException("unsupported type: "
17: + type);
18: return KeyStroke.getKeyStroke(string);
19: }
20: }
|