]>
Commit | Line | Data |
---|---|---|
7bde45b2 | 1 | /* JCheckBoxMenuItem.java -- |
af008858 | 2 | Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
7bde45b2 BM |
3 | |
4 | This file is part of GNU Classpath. | |
5 | ||
6 | GNU Classpath is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU Classpath is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Classpath; see the file COPYING. If not, write to the | |
18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
19 | 02111-1307 USA. | |
20 | ||
21 | Linking this library statically or dynamically with other modules is | |
22 | making a combined work based on this library. Thus, the terms and | |
23 | conditions of the GNU General Public License cover the whole | |
24 | combination. | |
25 | ||
26 | As a special exception, the copyright holders of this library give you | |
27 | permission to link this library with independent modules to produce an | |
28 | executable, regardless of the license terms of these independent | |
29 | modules, and to copy and distribute the resulting executable under | |
30 | terms of your choice, provided that you also meet, for each linked | |
31 | independent module, the terms and conditions of the license of that | |
32 | module. An independent module is a module which is not derived from | |
33 | or based on this library. If you modify this library, you may extend | |
34 | this exception to your version of the library, but you are not | |
35 | obligated to do so. If you do not wish to do so, delete this | |
36 | exception statement from your version. */ | |
37 | ||
38 | package javax.swing; | |
39 | ||
af008858 MK |
40 | import java.io.IOException; |
41 | import java.io.ObjectOutputStream; | |
42 | import javax.accessibility.Accessible; | |
43 | import javax.accessibility.AccessibleContext; | |
44 | import javax.accessibility.AccessibleRole; | |
7bde45b2 | 45 | |
7bde45b2 | 46 | |
c5d2de6b GH |
47 | /** |
48 | * DOCUMENT ME! | |
49 | * | |
50 | * @author $author$ | |
51 | * @version $Revision: 1.3.8.3 $ | |
52 | */ | |
31e632d3 GH |
53 | public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, |
54 | Accessible | |
55 | { | |
31e632d3 GH |
56 | private static final String uiClassID = "CheckBoxMenuItemUI"; |
57 | private boolean state; | |
58 | private Object[] selectedObjects; | |
59 | ||
c5d2de6b GH |
60 | /** |
61 | * Creates a new JCheckBoxMenuItem object. | |
62 | */ | |
31e632d3 GH |
63 | public JCheckBoxMenuItem() |
64 | { | |
65 | this(null, null); | |
c5d2de6b | 66 | } |
31e632d3 | 67 | |
c5d2de6b GH |
68 | /** |
69 | * Creates a new JCheckBoxMenuItem object. | |
70 | * | |
71 | * @param icon DOCUMENT ME! | |
72 | */ | |
31e632d3 GH |
73 | public JCheckBoxMenuItem(Icon icon) |
74 | { | |
75 | this(null, icon); | |
c5d2de6b | 76 | } |
31e632d3 | 77 | |
c5d2de6b GH |
78 | /** |
79 | * Creates a new JCheckBoxMenuItem object. | |
80 | * | |
81 | * @param text DOCUMENT ME! | |
82 | */ | |
31e632d3 GH |
83 | public JCheckBoxMenuItem(String text) |
84 | { | |
85 | this(text, null); | |
c5d2de6b | 86 | } |
31e632d3 | 87 | |
c5d2de6b GH |
88 | /** |
89 | * Creates a new JCheckBoxMenuItem object. | |
90 | * | |
91 | * @param action DOCUMENT ME! | |
92 | */ | |
31e632d3 GH |
93 | public JCheckBoxMenuItem(Action action) |
94 | { | |
95 | this(); | |
96 | setAction(action); | |
c5d2de6b GH |
97 | } |
98 | ||
99 | /** | |
100 | * Creates a new JCheckBoxMenuItem object. | |
101 | * | |
102 | * @param text DOCUMENT ME! | |
103 | * @param icon DOCUMENT ME! | |
104 | */ | |
31e632d3 GH |
105 | public JCheckBoxMenuItem(String text, Icon icon) |
106 | { | |
107 | this(text, icon, false); | |
c5d2de6b GH |
108 | } |
109 | ||
110 | /** | |
111 | * Creates a new JCheckBoxMenuItem object. | |
112 | * | |
113 | * @param text DOCUMENT ME! | |
114 | * @param state DOCUMENT ME! | |
115 | */ | |
31e632d3 GH |
116 | public JCheckBoxMenuItem(String text, boolean state) |
117 | { | |
118 | this(text, null, state); | |
c5d2de6b GH |
119 | } |
120 | ||
121 | /** | |
122 | * Creates a new JCheckBoxMenuItem object. | |
123 | * | |
124 | * @param text DOCUMENT ME! | |
125 | * @param icon DOCUMENT ME! | |
126 | * @param state DOCUMENT ME! | |
127 | */ | |
31e632d3 GH |
128 | public JCheckBoxMenuItem(String text, Icon icon, boolean state) |
129 | { | |
130 | super(text, icon); | |
131 | setModel(new JToggleButton.ToggleButtonModel()); | |
132 | this.state = state; | |
c5d2de6b GH |
133 | } |
134 | ||
135 | /** | |
136 | * DOCUMENT ME! | |
137 | * | |
138 | * @param stream DOCUMENT ME! | |
139 | * | |
140 | * @throws IOException DOCUMENT ME! | |
141 | */ | |
31e632d3 GH |
142 | private void writeObject(ObjectOutputStream stream) throws IOException |
143 | { | |
144 | // TODO | |
c5d2de6b | 145 | } |
31e632d3 | 146 | |
c5d2de6b GH |
147 | /** |
148 | * DOCUMENT ME! | |
149 | * | |
150 | * @return $returnType$ DOCUMENT ME! | |
151 | */ | |
31e632d3 GH |
152 | public String getUIClassID() |
153 | { | |
154 | return uiClassID; | |
c5d2de6b | 155 | } |
31e632d3 | 156 | |
c5d2de6b GH |
157 | /** |
158 | * DOCUMENT ME! | |
159 | * | |
160 | * @return $returnType$ DOCUMENT ME! | |
161 | */ | |
31e632d3 GH |
162 | public boolean getState() |
163 | { | |
164 | return state; | |
c5d2de6b | 165 | } |
31e632d3 | 166 | |
c5d2de6b GH |
167 | /** |
168 | * DOCUMENT ME! | |
169 | * | |
170 | * @param state DOCUMENT ME! | |
171 | */ | |
31e632d3 GH |
172 | public synchronized void setState(boolean state) |
173 | { | |
174 | this.state = state; | |
c5d2de6b | 175 | } |
31e632d3 | 176 | |
c5d2de6b GH |
177 | /** |
178 | * DOCUMENT ME! | |
179 | * | |
180 | * @return $returnType$ DOCUMENT ME! | |
181 | */ | |
31e632d3 GH |
182 | public Object[] getSelectedObjects() |
183 | { | |
184 | return selectedObjects; | |
c5d2de6b | 185 | } |
31e632d3 | 186 | |
c5d2de6b GH |
187 | /** |
188 | * DOCUMENT ME! | |
189 | */ | |
31e632d3 GH |
190 | public void requestFocus() |
191 | { | |
192 | // TODO | |
c5d2de6b | 193 | } |
31e632d3 | 194 | |
c5d2de6b GH |
195 | /** |
196 | * DOCUMENT ME! | |
197 | * | |
198 | * @return $returnType$ DOCUMENT ME! | |
199 | */ | |
31e632d3 GH |
200 | protected String paramString() |
201 | { | |
202 | return "JCheckBoxMenuItem"; | |
c5d2de6b | 203 | } |
31e632d3 | 204 | |
c5d2de6b GH |
205 | /** |
206 | * DOCUMENT ME! | |
207 | * | |
208 | * @return $returnType$ DOCUMENT ME! | |
209 | */ | |
31e632d3 GH |
210 | public AccessibleContext getAccessibleContext() |
211 | { | |
212 | if (accessibleContext == null) | |
c5d2de6b | 213 | accessibleContext = new AccessibleJCheckBoxMenuItem(this); |
31e632d3 GH |
214 | |
215 | return accessibleContext; | |
c5d2de6b GH |
216 | } |
217 | ||
218 | /** | |
219 | * DOCUMENT ME! | |
220 | * | |
221 | * @author $author$ | |
222 | * @version $Revision: 1.3.8.3 $ | |
223 | */ | |
31e632d3 GH |
224 | protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem |
225 | { | |
c5d2de6b GH |
226 | /** |
227 | * Creates a new AccessibleJCheckBoxMenuItem object. | |
228 | * | |
229 | * @param component DOCUMENT ME! | |
230 | */ | |
31e632d3 GH |
231 | protected AccessibleJCheckBoxMenuItem(JCheckBoxMenuItem component) |
232 | { | |
233 | super(component); | |
234 | ||
235 | // TODO | |
c5d2de6b | 236 | } |
31e632d3 | 237 | |
c5d2de6b GH |
238 | /** |
239 | * DOCUMENT ME! | |
240 | * | |
241 | * @return $returnType$ DOCUMENT ME! | |
242 | */ | |
31e632d3 GH |
243 | public AccessibleRole getAccessibleRole() |
244 | { | |
245 | return AccessibleRole.CHECK_BOX; | |
c5d2de6b GH |
246 | } |
247 | } | |
248 | } |