01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Alexander T. Simbirtsev
19: * @version $Revision$
20: */package javax.swing;
21:
22: import javax.accessibility.AccessibleContext;
23: import javax.accessibility.AccessibleRole;
24:
25: public class JRadioButtonMenuItem extends JMenuItem {
26: protected class AccessibleJRadioButtonMenuItem extends
27: AccessibleJMenuItem {
28: public AccessibleRole getAccessibleRole() {
29: return AccessibleRole.RADIO_BUTTON;
30: }
31: }
32:
33: private final static String UI_CLASS_ID = "RadioButtonMenuItemUI";
34:
35: public JRadioButtonMenuItem() {
36: this (null, null, false);
37: }
38:
39: public JRadioButtonMenuItem(final Icon icon) {
40: this (null, icon, false);
41: }
42:
43: public JRadioButtonMenuItem(final String text) {
44: this (text, null, false);
45: }
46:
47: public JRadioButtonMenuItem(final String text,
48: final boolean selected) {
49: this (text, null, false);
50: }
51:
52: public JRadioButtonMenuItem(final String text, final Icon icon) {
53: this (text, icon, false);
54: }
55:
56: public JRadioButtonMenuItem(final Icon icon, final boolean selected) {
57: this (null, icon, selected);
58: }
59:
60: public JRadioButtonMenuItem(final String text, final Icon icon,
61: final boolean selected) {
62: setDefaultModelAndFocus();
63: setSelected(selected);
64: init(text, icon);
65: }
66:
67: public JRadioButtonMenuItem(final Action action) {
68: super (action);
69: }
70:
71: public String getUIClassID() {
72: return UI_CLASS_ID;
73: }
74:
75: public AccessibleContext getAccessibleContext() {
76: return (accessibleContext == null) ? (accessibleContext = new AccessibleJRadioButtonMenuItem())
77: : accessibleContext;
78: }
79:
80: ButtonModel createDefaultModel() {
81: return new JToggleButton.ToggleButtonModel();
82: }
83: }
|