1. /*
  2. * @(#)SynthDefaultLookup.java 1.4 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.synth;
  8. import sun.swing.DefaultLookup;
  9. import javax.swing.JComponent;
  10. import javax.swing.plaf.ComponentUI;
  11. import sun.swing.plaf.synth.SynthUI;
  12. /**
  13. * SynthDefaultLookup redirects all lookup calls to the SynthContext.
  14. *
  15. * @version 1.4 12/19/03
  16. * @author Scott Violet
  17. */
  18. class SynthDefaultLookup extends DefaultLookup {
  19. public Object getDefault(JComponent c, ComponentUI ui, String key) {
  20. if (!(ui instanceof SynthUI)) {
  21. Object value = super.getDefault(c, ui, key);
  22. return value;
  23. }
  24. SynthContext context = ((SynthUI)ui).getContext(c);
  25. Object value = context.getStyle().get(context, key);
  26. context.dispose();
  27. return value;
  28. }
  29. }