01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.core.gui.action;
17:
18: import javax.swing.Action;
19: import javax.swing.JRadioButtonMenuItem;
20:
21: import org.columba.core.gui.base.MnemonicSetter;
22:
23: /**
24: * Quick fix to fix the Mnemonic correctly.
25: * @author redsolo
26: */
27:
28: public class CRadioButtonMenuItem extends JRadioButtonMenuItem {
29:
30: /**
31: * default constructor
32: */
33: public CRadioButtonMenuItem() {
34: super ();
35: }
36:
37: /**
38: * @param name the name of the radio button.
39: */
40: public CRadioButtonMenuItem(String name) {
41: super ();
42: // Set text, possibly with a mnemonic if defined using &
43: MnemonicSetter.setTextWithMnemonic(this , name);
44: }
45:
46: /**
47: * Creates a checkbox menu item with a given action attached.
48: * <br>
49: * If the name of the action contains &, the next character is used as
50: * mnemonic. If not, the fall-back solution is to use default behaviour,
51: * i.e. the mnemonic defined using setMnemonic on the action.
52: *
53: * @param action The action to attach to the menu item
54: */
55: public CRadioButtonMenuItem(AbstractColumbaAction action) {
56: super (action);
57:
58: // Set text, possibly with a mnemonic if defined using &
59: MnemonicSetter.setTextWithMnemonic(this , (String) action
60: .getValue(Action.NAME));
61: }
62: }
|