KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdnc > markup > attr > MenuAttributes


1 /*
2  * $Id: MenuAttributes.java,v 1.1.1.1 2004/06/16 01:43:40 davidson1 Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.jdnc.markup.attr;
9
10 import javax.swing.JMenu JavaDoc;
11
12 import net.openmarkup.ApplierException;
13 import net.openmarkup.AttributeApplier;
14 import net.openmarkup.Realizable;
15
16 /**
17  * Attribute appliers for the Menu element
18  *
19  * @author Mark Davidson
20  */

21 public class MenuAttributes {
22
23     public static final AttributeApplier titleApplier = new AttributeApplier() {
24         public void apply(Realizable target, String JavaDoc namespaceURI,
25                   String JavaDoc attributeName, String JavaDoc attributeValue)
26         throws ApplierException {
27         JMenu JavaDoc menu = (JMenu JavaDoc)target.getObject();
28         menu.setText(attributeValue);
29         }
30     };
31
32     public static final AttributeApplier mnemonicApplier = new AttributeApplier() {
33         public void apply(Realizable target, String JavaDoc namespaceURI,
34                   String JavaDoc attributeName, String JavaDoc attributeValue)
35         throws ApplierException {
36         JMenu JavaDoc menu = (JMenu JavaDoc)target.getObject();
37         menu.setMnemonic(attributeValue.charAt(0));
38         }
39     };
40
41     public static final AttributeApplier descriptionApplier = new AttributeApplier() {
42         public void apply(Realizable target, String JavaDoc namespaceURI,
43                   String JavaDoc attributeName, String JavaDoc attributeValue)
44         throws ApplierException {
45         JMenu JavaDoc menu = (JMenu JavaDoc)target.getObject();
46         menu.setToolTipText(attributeValue);
47         }
48     };
49 }
50
Popular Tags