1. /*
  2. * @(#)UIDefaults.java 1.39 01/02/09
  3. *
  4. * Copyright 1997-2001 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing;
  11. import javax.swing.plaf.ComponentUI;
  12. import javax.swing.border.*;
  13. import javax.swing.event.SwingPropertyChangeSupport;
  14. import java.lang.reflect.*;
  15. import java.util.Hashtable;
  16. import java.awt.Font;
  17. import java.awt.Color;
  18. import java.awt.Insets;
  19. import java.awt.Dimension;
  20. import java.lang.reflect.Method;
  21. import java.beans.PropertyChangeListener;
  22. import java.beans.PropertyChangeEvent;
  23. /**
  24. * A table of defaults for Swing components. Applications can set/get
  25. * default values via the <code>UIManager</code>.
  26. * <p>
  27. * <strong>Warning:</strong>
  28. * Serialized objects of this class will not be compatible with
  29. * future Swing releases. The current serialization support is appropriate
  30. * for short term storage or RMI between applications running the same
  31. * version of Swing. A future release of Swing will provide support for
  32. * long term persistence.
  33. *
  34. * @see UIManager
  35. * @version 1.39 02/09/01
  36. * @author Hans Muller
  37. */
  38. public class UIDefaults extends Hashtable
  39. {
  40. private static final Object PENDING = new String("Pending");
  41. private SwingPropertyChangeSupport changeSupport;
  42. /**
  43. * Create an empty defaults table.
  44. */
  45. public UIDefaults() {
  46. super();
  47. }
  48. /**
  49. * Create a defaults table initialized with the specified
  50. * key/value pairs. For example:
  51. * <pre>
  52. Object[] uiDefaults = {
  53. "Font", new Font("Dialog", Font.BOLD, 12),
  54. "Color", Color.red,
  55. "five", new Integer(5)
  56. }
  57. UIDefaults myDefaults = new UIDefaults(uiDefaults);
  58. * </pre>
  59. * @param keyValueList an array of objects containing the key/value
  60. * pairs
  61. */
  62. public UIDefaults(Object[] keyValueList) {
  63. super(keyValueList.length / 2);
  64. for(int i = 0; i < keyValueList.length; i += 2) {
  65. super.put(keyValueList[i], keyValueList[i + 1]);
  66. }
  67. }
  68. /**
  69. * Returns the value for key. If the value is a
  70. * <code>UIDefaults.LazyValue</code> then the real
  71. * value is computed with <code>LazyValue.createValue()</code>,
  72. * the table entry is replaced, and the real value is returned.
  73. * If the value is an <code>UIDefaults.ActiveValue</code>
  74. * the table entry is not replaced - the value is computed
  75. * with <code>ActiveValue.createValue()</code> for each
  76. * <code>get()</code> call.
  77. *
  78. * @param key the desired key
  79. * @return the value for <code>key</code>
  80. * @see LazyValue
  81. * @see ActiveValue
  82. * @see java.util.Hashtable#get
  83. */
  84. public Object get(Object key)
  85. {
  86. /* Quickly handle the common case, without grabbing
  87. * a lock.
  88. */
  89. Object value = super.get(key);
  90. if ((value != PENDING) &&
  91. !(value instanceof ActiveValue) &&
  92. !(value instanceof LazyValue)) {
  93. return value;
  94. }
  95. /* If the LazyValue for key is being constructed by another
  96. * thread then wait and then return the new value, otherwise drop
  97. * the lock and construct the ActiveValue or the LazyValue.
  98. * We use the special value PENDING to mark LazyValues that
  99. * are being constructed.
  100. */
  101. synchronized(this) {
  102. value = super.get(key);
  103. if (value == PENDING) {
  104. do {
  105. try {
  106. this.wait();
  107. }
  108. catch (InterruptedException e) {
  109. }
  110. value = super.get(key);
  111. }
  112. while(value == PENDING);
  113. return value;
  114. }
  115. else if (value instanceof LazyValue) {
  116. super.put(key, PENDING);
  117. }
  118. else if (!(value instanceof ActiveValue)) {
  119. return value;
  120. }
  121. }
  122. /* At this point we know that the value of key was
  123. * a LazyValue or an ActiveValue.
  124. */
  125. if (value instanceof LazyValue) {
  126. try {
  127. /* If an exception is thrown we'll just put the LazyValue
  128. * back in the table.
  129. */
  130. value = ((LazyValue)value).createValue(this);
  131. }
  132. finally {
  133. synchronized(this) {
  134. if (value == null) {
  135. super.remove(key);
  136. }
  137. else {
  138. super.put(key, value);
  139. }
  140. this.notifyAll();
  141. }
  142. }
  143. }
  144. else {
  145. value = ((ActiveValue)value).createValue(this);
  146. }
  147. return value;
  148. }
  149. /**
  150. * Sets the value of <code>key</code> to <code>value</code>.
  151. * If <code>key</code> is a string and the new value isn't
  152. * equal to the old one, fire a <code>PropertyChangeEvent</code>.
  153. * If value is <code>null</code>, the key is removed from the table.
  154. *
  155. * @param key the unique <code>Object</code> who's value will be used
  156. * to retrieve the data value associated with it
  157. * @param value the new <code>Object</code> to store as data under
  158. * that key
  159. * @return the previous <code>Object</code> value, or <code>null</code>
  160. * @see #putDefaults
  161. * @see java.util.Hashtable#put
  162. */
  163. public Object put(Object key, Object value) {
  164. Object oldValue = (value == null) ? super.remove(key) : super.put(key, value);
  165. if (key instanceof String) {
  166. firePropertyChange((String)key, oldValue, value);
  167. }
  168. return oldValue;
  169. }
  170. /**
  171. * Puts all of the key/value pairs in the database and
  172. * unconditionally generates one <code>PropertyChangeEvent</code>.
  173. * The events oldValue and newValue will be <code>null</code> and its
  174. * <code>propertyName</code> will be "UIDefaults".
  175. *
  176. * @param keyValueList an array of key/value pairs
  177. * @see #put
  178. * @see java.util.Hashtable#put
  179. */
  180. public void putDefaults(Object[] keyValueList) {
  181. for(int i = 0; i < keyValueList.length; i += 2) {
  182. Object value = keyValueList[i + 1];
  183. if (value == null) {
  184. super.remove(keyValueList[i]);
  185. }
  186. else {
  187. super.put(keyValueList[i], value);
  188. }
  189. }
  190. firePropertyChange("UIDefaults", null, null);
  191. }
  192. /**
  193. * If the value of <code>key</code> is a <code>Font</code> return it,
  194. * otherwise return <code>null</code>.
  195. * @param key the desired key
  196. * @return if the value for <code>key</code> is a <code>Font</code>,
  197. * return the <code>Font</code> object; otherwise return
  198. * <code>null</code>
  199. */
  200. public Font getFont(Object key) {
  201. Object value = get(key);
  202. return (value instanceof Font) ? (Font)value : null;
  203. }
  204. /**
  205. * If the value of <code>key</code> is a <code>Color</code> return it,
  206. * otherwise return <code>null</code>.
  207. * @param key the desired key
  208. * @return if the value for <code>key</code> is a <code>Color</code>,
  209. * return the <code>Color</code> object; otherwise return
  210. * <code>null</code>
  211. */
  212. public Color getColor(Object key) {
  213. Object value = get(key);
  214. return (value instanceof Color) ? (Color)value : null;
  215. }
  216. /**
  217. * If the value of <code>key</code> is an <code>Icon</code> return it,
  218. * otherwise return <code>null</code>.
  219. * @param key the desired key
  220. * @return if the value for <code>key</code> is an <code>Icon</code>,
  221. * return the <code>Icon</code> object; otherwise return
  222. * <code>null</code>
  223. */
  224. public Icon getIcon(Object key) {
  225. Object value = get(key);
  226. return (value instanceof Icon) ? (Icon)value : null;
  227. }
  228. /**
  229. * If the value of <code>key</code> is a <code>Border</code> return it,
  230. * otherwise return <code>null</code>.
  231. * @param key the desired key
  232. * @return if the value for <code>key</code> is a <code>Border</code>,
  233. * return the <code>Border</code> object; otherwise return
  234. * <code>null</code>
  235. */
  236. public Border getBorder(Object key) {
  237. Object value = get(key);
  238. return (value instanceof Border) ? (Border)value : null;
  239. }
  240. /**
  241. * If the value of <code>key</code> is a <code>String</code> return it,
  242. * otherwise return <code>null</code>.
  243. * @param key the desired key
  244. * @return if the value for <code>key</code> is a <code>String</code>,
  245. * return the <code>String</code> object; otherwise return
  246. * <code>null</code>
  247. */
  248. public String getString(Object key) {
  249. Object value = get(key);
  250. return (value instanceof String) ? (String)value : null;
  251. }
  252. /**
  253. * If the value of <code>key</code> is an <code>Integer</code> return its
  254. * integer value, otherwise return 0.
  255. * @param key the desired key
  256. * @return if the value for <code>key</code> is an <code>Integer</code>,
  257. * return its value, otherwise return 0
  258. */
  259. public int getInt(Object key) {
  260. Object value = get(key);
  261. return (value instanceof Integer) ? ((Integer)value).intValue() : 0;
  262. }
  263. /**
  264. * If the value of <code>key</code> is an <code>Insets</code> return it,
  265. * otherwise return <code>null</code>.
  266. * @param key the desired key
  267. * @return if the value for <code>key</code> is an <code>Insets</code>,
  268. * return the <code>Insets</code> object; otherwise return
  269. * <code>null</code>
  270. */
  271. public Insets getInsets(Object key) {
  272. Object value = get(key);
  273. return (value instanceof Insets) ? (Insets)value : null;
  274. }
  275. /**
  276. * If the value of <code>key</code> is a <code>Dimension</code> return it,
  277. * otherwise return <code>null</code>.
  278. * @param key the desired key
  279. * @return if the value for <code>key</code> is a <code>Dimension</code>,
  280. * return the <code>Dimension</code> object; otherwise return
  281. * <code>null</code>
  282. */
  283. public Dimension getDimension(Object key) {
  284. Object value = get(key);
  285. return (value instanceof Dimension) ? (Dimension)value : null;
  286. }
  287. /**
  288. * The value of <code>get(uidClassID)</code> must be the
  289. * <code>String</code> name of a
  290. * class that implements the corresponding <code>ComponentUI</code>
  291. * class. If the class hasn't been loaded before, this method looks
  292. * up the class with <code>uiClassLoader.loadClass()</code> if a non
  293. * <code>null</code>
  294. * class loader is provided, <code>classForName()</code> otherwise.
  295. * <p>
  296. * If a mapping for <code>uiClassID</code> exists or if the specified
  297. * class can't be found, return <code>null</code>.
  298. * <p>
  299. * This method is used by <code>getUI</code>, it's usually
  300. * not neccessary to call it directly.
  301. *
  302. * @param uiClassID a string containing the class ID
  303. * @param uiClassLoader the object which will load the class
  304. * @return the value of <code>Class.forName(get(uidClassID))</code>
  305. * @see #getUI
  306. */
  307. public Class getUIClass(String uiClassID, ClassLoader uiClassLoader)
  308. {
  309. try {
  310. String className = (String)get(uiClassID);
  311. Class cls = (Class)get(className);
  312. if (cls == null) {
  313. if (uiClassLoader == null) {
  314. cls = SwingUtilities.loadSystemClass(className);
  315. }
  316. else {
  317. cls = uiClassLoader.loadClass(className);
  318. }
  319. if (cls != null) {
  320. // Save lookup for future use, as forName is slow.
  321. put(className, cls);
  322. }
  323. }
  324. return cls;
  325. }
  326. catch (ClassNotFoundException e) {
  327. return null;
  328. }
  329. catch (ClassCastException e) {
  330. return null;
  331. }
  332. }
  333. /**
  334. * Returns the L&F class that renders this component.
  335. *
  336. * @param uiClassID a string containing the class ID
  337. * @return the Class object returned by
  338. * <code>getUIClass(uiClassID, null)</code>
  339. */
  340. public Class getUIClass(String uiClassID) {
  341. return getUIClass(uiClassID, null);
  342. }
  343. /**
  344. * If <code>getUI()</code> fails for any reason,
  345. * it calls this method before returning <code>null</code>.
  346. * Subclasses may choose to do more or less here.
  347. *
  348. * @param msg message string to print
  349. * @see #getUI
  350. */
  351. protected void getUIError(String msg) {
  352. System.err.println("UIDefaults.getUI() failed: " + msg);
  353. try {
  354. throw new Error();
  355. }
  356. catch (Throwable e) {
  357. e.printStackTrace();
  358. }
  359. }
  360. /**
  361. * Creates an <code>ComponentUI</code> implementation for the
  362. * specified component. In other words create the look
  363. * and feel specific delegate object for <code>target</code>.
  364. * This is done in two steps:
  365. * <ul>
  366. * <li> Look up the name of the <code>ComponentUI</code> implementation
  367. * class under the value returned by <code>target.getUIClassID()</code>.
  368. * <li> Use the implementation classes static <code>createUI()</code>
  369. * method to construct a look and feel delegate.
  370. * </ul>
  371. * @param target the <code>JComponent</code> which needs a UI
  372. * @return the <code>ComponentUI</code> object
  373. */
  374. public ComponentUI getUI(JComponent target)
  375. {
  376. Object cl = get("ClassLoader");
  377. ClassLoader uiClassLoader =
  378. (cl != null) ? (ClassLoader)cl : target.getClass().getClassLoader();
  379. Class uiClass = getUIClass(target.getUIClassID(), uiClassLoader);
  380. Object uiObject = null;
  381. if (uiClass == null) {
  382. getUIError("no ComponentUI class for: " + target);
  383. }
  384. else {
  385. try {
  386. Method m = (Method)get(uiClass);
  387. if (m == null) {
  388. Class acClass = javax.swing.JComponent.class;
  389. m = uiClass.getMethod("createUI", new Class[]{acClass});
  390. put(uiClass, m);
  391. }
  392. uiObject = m.invoke(null, new Object[]{target});
  393. }
  394. catch (NoSuchMethodException e) {
  395. getUIError("static createUI() method not found in " + uiClass);
  396. }
  397. catch (Exception e) {
  398. getUIError("createUI() failed for " + target + " " + e);
  399. }
  400. }
  401. return (ComponentUI)uiObject;
  402. }
  403. /**
  404. * Adds a <code>PropertyChangeListener</code> to the listener list.
  405. * The listener is registered for all properties.
  406. * <p>
  407. * A <code>PropertyChangeEvent</code> will get fired whenever a default
  408. * is changed.
  409. *
  410. * @param listener the <code>PropertyChangeListener</code> to be added
  411. * @see java.beans.PropertyChangeSupport
  412. */
  413. public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
  414. if (changeSupport == null) {
  415. changeSupport = new SwingPropertyChangeSupport(this);
  416. }
  417. changeSupport.addPropertyChangeListener(listener);
  418. }
  419. /**
  420. * Removes a <code>PropertyChangeListener</code> from the listener list.
  421. * This removes a <code>PropertyChangeListener</code> that was registered
  422. * for all properties.
  423. *
  424. * @param listener the <code>PropertyChangeListener</code> to be removed
  425. * @see java.beans.PropertyChangeSupport
  426. */
  427. public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
  428. if (changeSupport != null) {
  429. changeSupport.removePropertyChangeListener(listener);
  430. }
  431. }
  432. /**
  433. * Support for reporting bound property changes. If oldValue and
  434. * newValue are not equal and the <code>PropertyChangeEvent</code>x
  435. * listener list isn't empty, then fire a
  436. * <code>PropertyChange</code> event to each listener.
  437. *
  438. * @param propertyName the programmatic name of the property
  439. * that was changed
  440. * @param oldValue the old value of the property
  441. * @param newValue the new value of the property
  442. * @see java.beans.PropertyChangeSupport
  443. */
  444. protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
  445. if (changeSupport != null) {
  446. changeSupport.firePropertyChange(propertyName, oldValue, newValue);
  447. }
  448. }
  449. /**
  450. * This class enables one to store an entry in the defaults
  451. * table that isn't constructed until the first time it's
  452. * looked up with one of the <code>getXXX(key)</code> methods.
  453. * Lazy values are useful for defaults that are expensive
  454. * to construct or are seldom retrieved. The first time
  455. * a <code>LazyValue</code> is retrieved its "real value" is computed
  456. * by calling <code>LazyValue.createValue()</code> and the real
  457. * value is used to replace the <code>LazyValue</code> in the
  458. * <code>UIDefaults</code>
  459. * table. Subsequent lookups for the same key return
  460. * the real value. Here's an example of a <code>LazyValue</code>
  461. * that constructs a <code>Border</code>:
  462. * <pre>
  463. * Object borderLazyValue = new UIDefaults.LazyValue() {
  464. * public Object createValue(UIDefaults table) {
  465. * return new BorderFactory.createLoweredBevelBorder();
  466. * }
  467. * };
  468. *
  469. * uiDefaultsTable.put("MyBorder", borderLazyValue);
  470. * </pre>
  471. *
  472. * @see UIDefaults#get
  473. */
  474. public interface LazyValue {
  475. /**
  476. * Creates the actual value retrieved from the <code>UIDefaults</code>
  477. * table. When an object that implements this interface is
  478. * retrieved from the table, this method is used to create
  479. * the real value, which is then stored in the table and
  480. * returned to the calling method.
  481. *
  482. * @param table a <code>UIDefaults</code> table
  483. * @return the created <code>Object</code>
  484. */
  485. Object createValue(UIDefaults table);
  486. }
  487. /**
  488. * This class enables one to store an entry in the defaults
  489. * table that's constructed each time it's looked up with one of
  490. * the <code>getXXX(key)</code> methods. Here's an example of
  491. * an <code>ActiveValue</code> that constructs a
  492. * <code>DefaultListCellRenderer</code>:
  493. * <pre>
  494. * Object cellRendererActiveValue = new UIDefaults.ActiveValue() {
  495. * public Object createValue(UIDefaults table) {
  496. * return new DefaultListCellRenderer();
  497. * }
  498. * };
  499. *
  500. * uiDefaultsTable.put("MyRenderer", cellRendererActiveValue);
  501. * </pre>
  502. *
  503. * @see UIDefaults#get
  504. */
  505. public interface ActiveValue {
  506. /**
  507. * Creates the value retrieved from the <code>UIDefaults</code> table.
  508. * The object is created each time it is accessed.
  509. *
  510. * @param table a <code>UIDefaults</code> table
  511. * @return the created <code>Object</code>
  512. */
  513. Object createValue(UIDefaults table);
  514. }
  515. /**
  516. * This class provides an implementation of <code>LazyValue</code>
  517. * which can be
  518. * used to delay loading of the Class for the instance to be created.
  519. * It also avoids creation of an anonymous inner class for the
  520. * <code>LazyValue</code>
  521. * subclass. Both of these improve performance at the time that a
  522. * a Look and Feel is loaded, at the cost of a slight performance
  523. * reduction the first time <code>createValue</code> is called
  524. * (since Reflection APIs are used).
  525. */
  526. public static class ProxyLazyValue implements LazyValue {
  527. private String className;
  528. private String methodName;
  529. private Object[] args;
  530. /**
  531. * Creates a <code>LazyValue</code> which will construct an instance
  532. * when asked.
  533. *
  534. * @param c a <code>String</code> specifying the classname
  535. * of the instance to be created on demand
  536. */
  537. public ProxyLazyValue(String c) {
  538. className = c;
  539. }
  540. /**
  541. * Creates a <code>LazyValue</code> which will construct an instance
  542. * when asked.
  543. *
  544. * @param c a <code>String</code> specifying the classname of
  545. * the class
  546. * containing a static method to be called for
  547. * instance creation
  548. * @param m a <code>String</code> specifying the static
  549. * method to be called on class c
  550. */
  551. public ProxyLazyValue(String c, String m) {
  552. className = c;
  553. methodName = m;
  554. }
  555. /**
  556. * Creates a <code>LazyValue</code> which will construct an instance
  557. * when asked.
  558. *
  559. * @param c a <code>String</code> specifying the classname
  560. * of the instance to be created on demand
  561. * @param o an array of <code>Objects</code> to be passed as
  562. * paramaters to the constructor in class c
  563. */
  564. public ProxyLazyValue(String c, Object[] o) {
  565. className = c;
  566. args = o;
  567. }
  568. /**
  569. * Creates a <code>LazyValue</code> which will construct an instance
  570. * when asked.
  571. *
  572. * @param c a <code>String</code> specifying the classname
  573. * of the class
  574. * containing a static method to be called for
  575. * instance creation.
  576. * @param m a <code>String</code> specifying the static method
  577. * to be called on class c
  578. * @param o an array of <code>Objects</code> to be passed as
  579. * paramaters to the static method in class c
  580. */
  581. public ProxyLazyValue(String c, String m, Object[] o) {
  582. className = c;
  583. methodName = m;
  584. args = o;
  585. }
  586. /**
  587. * Creates the value retrieved from the <code>UIDefaults</code> table.
  588. * The object is created each time it is accessed.
  589. *
  590. * @param table a <code>UIDefaults</code> table
  591. * @return the created <code>Object</code>
  592. */
  593. public Object createValue(UIDefaults table) {
  594. Object instance = null;
  595. try {
  596. Class c = Class.forName(className);
  597. if (methodName !=null) {
  598. Class[] types = getClassArray(args);
  599. Method m = c.getMethod(methodName, types);
  600. instance = m.invoke(c, args);
  601. } else {
  602. Class[] types = getClassArray(args);
  603. try {
  604. Constructor constructor = c.getConstructor(types);
  605. instance = constructor.newInstance(args);
  606. } catch(Exception e) {
  607. System.out.println("Problem with constructor " + className +
  608. " and args " + printArgs(args) + " : " +
  609. " and types " + printArgs(types) + " : " + e);
  610. Thread.dumpStack();
  611. }
  612. }
  613. } catch(Exception e) {
  614. System.out.println("Problem creating " + className +
  615. " with method " + methodName +
  616. " and args " + printArgs(args) + " : " + e);
  617. Thread.dumpStack();
  618. }
  619. return instance;
  620. }
  621. /*
  622. * Coerce the array of class types provided into one which
  623. * looks the way the Reflection APIs expect. This is done
  624. * by substituting primitive types for their Object counterparts,
  625. * and superclasses for subclasses used to add the
  626. * <code>UIResource</code> tag.
  627. */
  628. private Class[] getClassArray(Object[] args) {
  629. Class[] types = null;
  630. if (args!=null) {
  631. types = new Class[args.length];
  632. for (int i = 0; i< args.length; i++) {
  633. /* PENDING(ges): At present only the primitive types
  634. used are handled correctly; this should eventually
  635. handle all primitive types */
  636. if (args[i] instanceof java.lang.Integer) {
  637. types[i]=Integer.TYPE;
  638. } else if (args[i] instanceof java.lang.Boolean) {
  639. types[i]=Boolean.TYPE;
  640. } else if (args[i] instanceof javax.swing.plaf.ColorUIResource) {
  641. /* PENDING(ges) Currently the Reflection APIs do not
  642. search superclasses of parameters supplied for
  643. constructor/method lookup. Since we only have
  644. one case where this is needed, we substitute
  645. directly instead of adding a massive amount
  646. of mechanism for this. Eventually this will
  647. probably need to handle the general case as well.
  648. */
  649. types[i]=java.awt.Color.class;
  650. } else {
  651. types[i]=args[i].getClass();
  652. }
  653. }
  654. }
  655. return types;
  656. }
  657. private String printArgs(Object[] array) {
  658. String s = "{";
  659. if (array !=null) {
  660. for (int i = 0 ; i < array.length-1; i++) {
  661. s = s.concat(array[i] + ",");
  662. }
  663. s = s.concat(array[array.length-1] + "}");
  664. } else {
  665. s.concat("}");
  666. }
  667. return s;
  668. }
  669. }
  670. /**
  671. * <code>LazyInputMap</code> will create a <code>InputMap</code>
  672. * in its <code>createValue</code>
  673. * method. The bindings are passed in in the constructor.
  674. * The bindings are an array with
  675. * the even number entries being string <code>KeyStrokes</code>
  676. * (eg "alt SPACE") and
  677. * the odd number entries being the value to use in the
  678. * <code>InputMap</code> (and the key in the <code>ActionMap</code>).
  679. */
  680. public static class LazyInputMap implements LazyValue {
  681. /** Key bindings are registered under. */
  682. private Object[] bindings;
  683. public LazyInputMap(Object[] bindings) {
  684. this.bindings = bindings;
  685. }
  686. /**
  687. * Creates an <code>InputMap</code> with the bindings that are
  688. * passed in.
  689. *
  690. * @param table a <code>UIDefaults</code> table
  691. * @return the <code>InputMap</code>
  692. */
  693. public Object createValue(UIDefaults table) {
  694. if (bindings != null) {
  695. InputMap km = LookAndFeel.makeInputMap(bindings);
  696. return km;
  697. }
  698. return null;
  699. }
  700. }
  701. }