KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > synth > SynthDefaultLookup


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
9 import sun.swing.DefaultLookup;
10 import javax.swing.JComponent JavaDoc;
11 import javax.swing.plaf.ComponentUI JavaDoc;
12 import sun.swing.plaf.synth.SynthUI;
13
14 /**
15  * SynthDefaultLookup redirects all lookup calls to the SynthContext.
16  *
17  * @version 1.4 12/19/03
18  * @author Scott Violet
19  */

20 class SynthDefaultLookup extends DefaultLookup {
21     public Object JavaDoc getDefault(JComponent JavaDoc c, ComponentUI JavaDoc ui, String JavaDoc key) {
22         if (!(ui instanceof SynthUI)) {
23             Object JavaDoc value = super.getDefault(c, ui, key);
24             return value;
25         }
26         SynthContext JavaDoc context = ((SynthUI)ui).getContext(c);
27         Object JavaDoc value = context.getStyle().get(context, key);
28         context.dispose();
29         return value;
30     }
31 }
32
Popular Tags