1174 return s; 1175 } 1176 } 1177 1178 1179 /** 1180 * <code>LazyInputMap</code> will create a <code>InputMap</code> 1181 * in its <code>createValue</code> 1182 * method. The bindings are passed in the constructor. 1183 * The bindings are an array with 1184 * the even number entries being string <code>KeyStrokes</code> 1185 * (eg "alt SPACE") and 1186 * the odd number entries being the value to use in the 1187 * <code>InputMap</code> (and the key in the <code>ActionMap</code>). 1188 * @since 1.3 1189 */ 1190 public static class LazyInputMap implements LazyValue { 1191 /** Key bindings are registered under. */ 1192 private Object[] bindings; 1193 1194 public LazyInputMap(Object[] bindings) { 1195 this.bindings = bindings; 1196 } 1197 1198 /** 1199 * Creates an <code>InputMap</code> with the bindings that are 1200 * passed in. 1201 * 1202 * @param table a <code>UIDefaults</code> table 1203 * @return the <code>InputMap</code> 1204 */ 1205 public Object createValue(UIDefaults table) { 1206 if (bindings != null) { 1207 InputMap km = LookAndFeel.makeInputMap(bindings); 1208 return km; 1209 } 1210 return null; 1211 } 1212 } 1213 | 1174 return s; 1175 } 1176 } 1177 1178 1179 /** 1180 * <code>LazyInputMap</code> will create a <code>InputMap</code> 1181 * in its <code>createValue</code> 1182 * method. The bindings are passed in the constructor. 1183 * The bindings are an array with 1184 * the even number entries being string <code>KeyStrokes</code> 1185 * (eg "alt SPACE") and 1186 * the odd number entries being the value to use in the 1187 * <code>InputMap</code> (and the key in the <code>ActionMap</code>). 1188 * @since 1.3 1189 */ 1190 public static class LazyInputMap implements LazyValue { 1191 /** Key bindings are registered under. */ 1192 private Object[] bindings; 1193 1194 /** 1195 * Constructs a {@code LazyInputMap}. 1196 * @param bindings the bindings 1197 */ 1198 public LazyInputMap(Object[] bindings) { 1199 this.bindings = bindings; 1200 } 1201 1202 /** 1203 * Creates an <code>InputMap</code> with the bindings that are 1204 * passed in. 1205 * 1206 * @param table a <code>UIDefaults</code> table 1207 * @return the <code>InputMap</code> 1208 */ 1209 public Object createValue(UIDefaults table) { 1210 if (bindings != null) { 1211 InputMap km = LookAndFeel.makeInputMap(bindings); 1212 return km; 1213 } 1214 return null; 1215 } 1216 } 1217 |