Source Code Cross Referenced for Choice.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package javax.microedition.lcdui;
028:
029:        /**
030:         * Choice defines an API for a user interface components implementing
031:         * selection from predefined number of choices. Such UI components are
032:         * {@link List List} and {@link ChoiceGroup ChoiceGroup}.
033:         * The contents of the <code>Choice</code> are represented
034:         * with strings and images.
035:         *
036:         * <P>Each element of a <code>Choice</code> is composed of a text string part,
037:         * an {@link Image Image} part, and a font attribute that are all treated as a
038:         * unit.  The font attribute applies to the text part and can be controlled by
039:         * the application.  The application may provide
040:         * <code>null</code> for the image if the element is not to have an image
041:         * part.  The implementation must display the image at the beginning of the
042:         * text string.  If the <code>Choice</code> also has a selection
043:         * indicator (such as a radio
044:         * button or a checkbox) placed at the beginning of the text string, the
045:         * element's image should be placed between the selection indicator and the
046:         * beginning of the text string.</P>
047:         *
048:         * <P>When a new element is inserted or appended, the implementation provides
049:         * a default font for the font attribute.  This default font is the same font
050:         * that is used if the application calls <code>setFont(i, null)</code>.  All
051:         * <code>ChoiceGroup</code> instances must have the same default font, and all
052:         * <code>List</code> instances must have the same default font.  However, the
053:         * default font used for <code>Choice</code> objects may differ from the font
054:         * returned by {@link Font#getDefaultFont() Font.getDefaultFont}.</P>
055:         *
056:         * <P>The <code>Image</code> part of a <code>Choice</code> element may
057:         * be mutable or immutable.  If the
058:         * <code>Image</code> is mutable, the effect is as if snapshot of its
059:         * contents is taken at
060:         * the time the <code>Choice</code> is constructed with this
061:         * <code>Image</code> or when the <code>Choice</code>
062:         * element is created or modified with the {@link #append append},
063:         * {@link #insert insert}, or {@link #set set} methods.
064:         * The snapshot is used whenever the contents of the
065:         * <code>Choice</code> element are to be displayed.  Even if the
066:         * application subsequently
067:         * draws into the <code>Image</code>, the snapshot is not modified
068:         * until the next call to
069:         * one of the above methods.  The snapshot is <em>not</em> updated when the
070:         * <code>Choice</code> becomes visible on the display.  (This is because the
071:         * application does not have control over exactly when
072:         * <code>Displayables</code> and <code>Items</code>
073:         * appear and disappear from the display.)</P>
074:         *
075:         * <P>The following code illustrates a technique to refresh the image part of 
076:         * element <code>k</code> of a <code>Choice</code> <code>ch</code>: </P>
077:         * <TABLE BORDER="2">
078:         * <TR>
079:         * <TD ROWSPAN="1" COLSPAN="1">
080:         *    <pre><code>
081:         *    ch.set(k, ch.getString(k), ch.getImage(k));    </code></pre>
082:         * </TD>
083:         * </TR>
084:         * </TABLE>
085:         *
086:         * <P>If the application provides an image, the implementation may choose to
087:         * truncate it if it exceeds the capacity of the device to display it.
088:         * <code>Images</code>
089:         * within any particular <code>Choice</code> object should all be of
090:         * the same size, because
091:         * the implementation is allowed to allocate the same amount of space for
092:         * every element.  The application can query the implementation's image size
093:         * recommendation by calling {@link Display#getBestImageWidth} and {@link
094:         * Display#getBestImageHeight}.</P>
095:         *
096:         * <P>If an element is very long or contains a
097:         * <A HREF="Form.html#linebreak">line break</A>,
098:         * the implementation may display only a
099:         * portion of it.  If this occurs, the implementation should provide
100:         * the user with a means to see as much as possible of the element.
101:         * If this is done by wrapping an element
102:         * to multiple lines, the second and subsequent lines should show a clear
103:         * indication to
104:         * the user that they are part of the same element and are not a
105:         * new element.</P>
106:         *
107:         * <P>The application can express a preference for the policy used by the
108:         * implementation for display of long elements including those that 
109:         * contain line break characters.  The characters after the first line break
110:         * may only be visible if the policy permits it. The {@link #setFitPolicy} and
111:         * {@link #getFitPolicy} methods control this preference.  The valid settings
112:         * are
113:         * {@link #TEXT_WRAP_DEFAULT}, {@link #TEXT_WRAP_ON}, and
114:         * {@link #TEXT_WRAP_OFF}.
115:         * Unless specified otherwise by <code>Choice</code> implementation
116:         * classes, the initial
117:         * value of the element fit policy is <code>TEXT_WRAP_DEFAULT</code>.</P>
118:         * 
119:         * <P>After a <code>Choice</code> object has been created, elements
120:         * may be inserted,
121:         * appended, and deleted, and each element's string part and image part may be 
122:         * get and set.  Elements within a <code>Choice</code> object are
123:         * referred to by their
124:         * indexes, which are consecutive integers in the range from zero to
125:         * <code>size()-1</code>,
126:         * with zero referring to the first element and <code>size()-1</code>
127:         * to the last element.
128:         * </P>
129:         * 
130:         * <P>There are four types of <code>Choices</code>: implicit-choice
131:         * (valid only for
132:         * {@link List List}), exclusive-choice,
133:         * multiple-choice, and pop-up (valid only for
134:         * {@link ChoiceGroup ChoiceGroup}). </p>
135:         *
136:         * <P>The exclusive-choice presents a series of elements and interacts with the
137:         * user. That is, when the user selects an element,
138:         * that element is shown to be selected using a distinct visual
139:         * representation. If there are elements present in the <code>Choice</code>,
140:         * one element must be selected at any given time.
141:         * If at any time a situation would result where there are elements in the
142:         * exclusive-choice but none is selected, the implementation will choose an
143:         * element and select it. This situation can arise when an element is added
144:         * to an empty <code>Choice</code>, when the selected element is
145:         * deleted from the
146:         * <code>Choice</code>, or when a <code>Choice</code> is created and
147:         * populated with elements
148:         * by a constructor.  In these cases, the choice of which element is
149:         * selected is left to the implementation.  Applications for
150:         * which the selected 
151:         * element is significant should set the selection explicitly.
152:         * The user cannot unselect an element within an
153:         * exclusive <code>Choice</code>.</p>
154:         *
155:         * <P>The popup choice is similar to the exclusive choice.  The selection
156:         * behavior of a popup choice is identical to that of an exclusive choice.
157:         * However, a popup choice differs from an exclusive choice in presentation
158:         * and interaction.  In an exclusive choice, all elements should be displayed
159:         * in-line.  In a popup choice, the selected element should always be
160:         * displayed, and the other elements should remain hidden until the user
161:         * performs a specific action to show them.  For example, an exclusive choice
162:         * could be implemented as a series of radio buttons with one always selected.
163:         * A popup choice could be implemented as a popup menu, with the selected
164:         * element being displayed in the menu button.</P>
165:         *
166:         * <P>The implicit choice is an exclusive choice where the focused or
167:         * highlighted element is implicitly selected when a command is initiated.  As
168:         * with the exclusive choice, if there are elements present in the
169:         * <code>Choice</code>, one element is always selected.</P>
170:         *
171:         * <P>A multiple-choice presents a series of elements and allows the user to
172:         * select any number of elements in any combination. As with
173:         * exclusive-choice, the multiple-choice interacts with the user in
174:         * object-operation mode. The visual appearance of a multiple-choice will
175:         * likely have a visual representation distinct from the exclusive-choice
176:         * that shows the selected state of each element as well as indicating to the
177:         * user that multiple elements may be selected. </P>
178:         *
179:         * <P>The selected state of an element is a property of the element. This state
180:         * stays with that element if other elements are inserted or deleted, causing
181:         * elements to be shifted around.  For example, suppose element <em>n</em> is
182:         * selected, and a new element is inserted at index zero.  The selected element
183:         * would now have index <em>n+1</em>.  A similar rule applies to deletion.  
184:         * Assuming <em>n</em> is greater than zero, deleting element zero would leave 
185:         * element <em>n-1</em> selected.  Setting the contents of an element leaves 
186:         * its selected state unchanged.  When a new element is inserted or appended, 
187:         * it is always unselected (except in the special case of adding an element to 
188:         * an empty Exclusive, Popup, or Implicit Choice as mentioned above).</P>
189:         *
190:         * <P>The selected state of a <code>Choice</code> object can be controlled by
191:         * the application with the {@link #setSelectedFlags setSelectedFlags} and
192:         * {@link #setSelectedIndex setSelectedIndex} methods.  This state is
193:         * available to the application through the {@link #getSelectedFlags
194:         * getSelectedFlags} and {@link #getSelectedIndex getSelectedIndex} methods.
195:         * The selected state reported by these methods
196:         * is generally identical to what has been set by the
197:         * application, with the following exceptions.  Adding or removing elements
198:         * may change the selection.  When the <code>Choice</code> is present on the
199:         * display, the implementation's user interface policy and direct user
200:         * interaction with the object may also affect the selection.  For example,
201:         * the implementation might update the selection to the current highlight
202:         * location as the user is moving the highlight, or it might set the selection
203:         * from the highlight only when the user is about to invoke a command.  As
204:         * another example, the implementation might move the highlight (and thus the
205:         * selection) of an implicit <code>List</code> to the first element each time
206:         * the <code>List</code> becomes current.  When a <code>Choice</code> object
207:         * is present on the display, applications should query its selected state
208:         * only within a {@link CommandListener CommandListener} or a {@link
209:         * ItemStateListener ItemStateListener} callback.  Querying the state at other
210:         * times might result in a value different from what has been set by the
211:         * application (because the user or the implementation's UI policy might have
212:         * changed it) and it might not reflect the user's intent (because the user
213:         * might still in the process of making a selection).</P>
214:         * 
215:         * <p>
216:         * <strong>Note:</strong> Methods have been added to the <code>Choice</code>
217:         * interface
218:         * in version 2.0.  Adding methods to interfaces is normally an incompatible
219:         * change.  However, <code>Choice</code> does not appear as a <em>type</em> in
220:         * any field, method parameter, or method return value, and so it is not
221:         * useful for an application to create a class that implements the
222:         * <code>Choice</code> interface.  Future versions of this specification may
223:         * make additional changes to the <code>Choice</code> interface.  In order to
224:         * remain compatible with future versions of this specification, applications
225:         * should avoid creating classes that implement the <code>Choice</code>
226:         * interface.
227:         * </p>
228:         * 
229:         * @since MIDP 1.0
230:         */
231:
232:        public interface Choice {
233:
234:            /**
235:             * <code>EXCLUSIVE</code> is a choice having exactly one element
236:             * selected at time.  All
237:             * elements of an <code>EXCLUSIVE</code> type <code>Choice</code>
238:             * should be displayed in-line.  That
239:             * is, the user should not need to perform any extra action to traverse
240:             * among and select from the elements.
241:             *
242:             * <P>Value <code>1</code> is assigned to <code>EXCLUSIVE</code>.</P>
243:             */
244:            public static final int EXCLUSIVE = 1;
245:
246:            /**
247:             * <code>MULTIPLE</code> is a choice that can have arbitrary number of
248:             * elements selected at a time.
249:             *
250:             * <P>Value <code>2</code> is assigned to <code>MULTIPLE</code>.</P>
251:             */
252:            public static final int MULTIPLE = 2;
253:
254:            /**
255:             * <code>IMPLICIT</code> is a choice in which the currently focused
256:             * element is selected when a {@link Command Command} is initiated.
257:             *
258:             * <P>The <code>IMPLICIT</code> type is not valid for {@link
259:             * ChoiceGroup} objects.</P>
260:             *
261:             * <P>Value <code>3</code> is assigned to <code>IMPLICIT</code>.</P>
262:             */
263:            public static final int IMPLICIT = 3;
264:
265:            /**
266:             * <code>POPUP</code> is a choice having exactly one element
267:             * selected at a time.  The
268:             * selected element is always shown.  The other elements should be hidden
269:             * until the user performs a particular action to show them.  When the
270:             * user performs this action, all elements become accessible.  For
271:             * example, an implementation could use a popup menu to display the
272:             * elements of a <code>ChoiceGroup</code> of type <code>POPUP</code>.
273:             *
274:             * <P>The <code>POPUP</code> type is not valid for {@link List} objects.</P>
275:             *
276:             * <P>Value <code>4</code> is assigned to <code>POPUP</code>.</P>
277:             *
278:             */
279:            public static final int POPUP = 4;
280:
281:            /**
282:             * Constant for indicating that the application has no preference as to 
283:             * wrapping or truncation of text element contents and that the 
284:             * implementation should use its default behavior.
285:             *
286:             * <p>Field has the value <code>0</code>.</p>
287:             *
288:             * @see #getFitPolicy
289:             * @see #setFitPolicy
290:             */
291:            public static final int TEXT_WRAP_DEFAULT = 0;
292:
293:            /**
294:             * Constant for hinting that text element contents should be wrapped to to
295:             * multiple lines if necessary to fit available content space.  The
296:             * Implementation may limit the maximum number of lines that it will
297:             * actually present.
298:             *
299:             * <p>Field has the value <code>1</code>.</p>
300:             * 
301:             * @see #getFitPolicy
302:             * @see #setFitPolicy
303:             */
304:            public static final int TEXT_WRAP_ON = 1;
305:
306:            /**
307:             * Constant for hinting that text element contents should be limited to a
308:             * single line.  Line ending is forced, for example by cropping, if there
309:             * is too much text to fit to the line.  The implementation should provide
310:             * some means to present the full element contents.  This may be done, for
311:             * example, by using a special pop-up window or by scrolling the text of
312:             * the focused element.
313:             * 
314:             * <p>Implementations should indicate that cropping has occurred, for
315:             * example, by placing an ellipsis at the point where the text contents
316:             * have been cropped.</p>
317:             *
318:             * <p>Field has the value <code>2</code>.</p>
319:             * 
320:             * @see #getFitPolicy
321:             * @see #setFitPolicy
322:             */
323:            public static final int TEXT_WRAP_OFF = 2;
324:
325:            /**
326:             * Gets the number of elements present.
327:             * @return the number of elements in the <code>Choice</code>
328:             */
329:            public int size();
330:
331:            /**
332:             * Gets the <code>String</code> part of the element referenced by
333:             * <code>elementNum</code>.
334:             * The <code>elementNum</code> parameter must be within the range
335:             * <code>[0..size()-1]</code>, inclusive. 
336:             *
337:             * @param elementNum the index of the element to be queried
338:             * @return the string part of the element
339:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
340:             * @see #getImage(int)
341:             */
342:            public String getString(int elementNum);
343:
344:            /**
345:             * Gets the <code>Image</code> part of the element referenced by
346:             * <code>elementNum</code>.
347:             * The <code>elementNum</code> parameter must be within the range
348:             * <code>[0..size()-1]</code>, inclusive. 
349:             *
350:             * @param elementNum the index of the element to be queried
351:             * @return the image part of the element, or <code>null</code>
352:             * if there is no image
353:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
354:             * @see #getString(int)
355:             */
356:            public Image getImage(int elementNum);
357:
358:            /**
359:             * Appends an element to the <code>Choice</code>. The added
360:             * element will be the last
361:             * element of the <code>Choice</code>. The size of the
362:             * <code>Choice</code> grows by one.
363:             *
364:             * @param stringPart the string part of the element to be added
365:             * @param imagePart the image part of the element to be added, 
366:             * or <code>null</code> if
367:             * there is no image part
368:             * @return the assigned index of the element
369:             * @throws NullPointerException if <code>stringPart</code>
370:             * is <code>null</code>
371:             */
372:            public int append(String stringPart, Image imagePart);
373:
374:            /**
375:             * Inserts an element into the <code>Choice</code> just prior to
376:             * the element specified.
377:             * The size of the <code>Choice</code> grows by one.
378:             * The <code>elementNum</code> parameter must be within the range
379:             * <code>[0..size()]</code>, inclusive.  The index of the last
380:             * element is <code>size()-1</code>, and
381:             * so there is actually no element whose index is
382:             * <code>size()</code>. If this value
383:             * is used for <code>elementNum</code>, the new element is
384:             * inserted immediately after
385:             * the last element. In this case, the effect is identical to
386:             * {@link #append(String, Image) append()}.
387:             * 
388:             * @param elementNum the index of the element where insertion is to occur
389:             * @param stringPart the string part of the element to be inserted
390:             * @param imagePart the image part of the element to be inserted,
391:             * or <code>null</code> if there is no image part
392:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
393:             * @throws NullPointerException if <code>stringPart</code>
394:             * is <code>null</code>
395:             */
396:            public void insert(int elementNum, String stringPart,
397:                    Image imagePart);
398:
399:            /**
400:             * Deletes the element referenced by <code>elementNum</code>.
401:             * The size of the <code>Choice</code> shrinks by
402:             * one. It is legal to delete all elements from a <code>Choice</code>.
403:             * The <code>elementNum</code> parameter must be within the range
404:             * <code>[0..size()-1]</code>, inclusive. 
405:             *
406:             * @param elementNum the index of the element to be deleted
407:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
408:             */
409:            public void delete(int elementNum);
410:
411:            /**
412:             * Deletes all elements from this <code>Choice</code>, leaving it
413:             * with zero elements.
414:             * This method does nothing if the <code>Choice</code> is already empty.
415:             *
416:             */
417:            public void deleteAll();
418:
419:            /**
420:             * Sets the <code>String</code> and <code>Image</code> parts of the
421:             * element referenced by <code>elementNum</code>,
422:             * replacing the previous contents of the element.
423:             * The <code>elementNum</code> parameter must be within the range
424:             * <code>[0..size()-1]</code>, inclusive.  The font attribute of
425:             * the element is left unchanged.
426:             * 
427:             * @param elementNum the index of the element to be set
428:             * @param stringPart the string part of the new element
429:             * @param imagePart the image part of the element, or 
430:             * <code>null</code> if there is
431:             * no image part
432:             *
433:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
434:             * @throws NullPointerException if <code>stringPart</code> 
435:             * is <code>null</code>
436:             */
437:            public void set(int elementNum, String stringPart, Image imagePart);
438:
439:            /**
440:             * Gets a boolean value indicating whether this element is selected.
441:             * The <code>elementNum</code> parameter must be within the range
442:             * <code>[0..size()-1]</code>, inclusive. 
443:             *
444:             * @param elementNum the index of the element to be queried
445:             *
446:             * @return selection state of the element
447:             *
448:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
449:             */
450:            public boolean isSelected(int elementNum);
451:
452:            /**
453:             * Returns the index number of an element in the <code>Choice</code> that is
454:             * selected. For
455:             * <code>Choice</code> types <code>EXCLUSIVE</code>,
456:             * <code>POPUP</code>, and <code>IMPLICIT</code>
457:             * there is at most one element selected, so
458:             * this method is useful for determining the user's
459:             * choice. Returns <code>-1</code> if
460:             * the <code>Choice</code> has no elements (and therefore has no
461:             * selected elements).
462:             *
463:             * <p>For <code>MULTIPLE</code>, this always returns
464:             * <code>-1</code> because no single
465:             * value can in general represent the state of such a <code>Choice</code>.
466:             * To get the complete state of a <code>MULTIPLE</code> <code>Choice</code>,
467:             * see {@link #getSelectedFlags(boolean[]) getSelectedFlags}.</p>
468:             *
469:             * @return index of selected element, or <code>-1</code> if none
470:             * @see #setSelectedIndex
471:             */
472:            public int getSelectedIndex();
473:
474:            /**
475:             * Queries the state of a <code>Choice</code> and returns the
476:             * state of all elements
477:             * in the
478:             * boolean array
479:             * <code>selectedArray_return</code>. <strong>Note:</strong> this
480:             * is a result parameter.
481:             * It must be at least as long as the size
482:             * of the <code>Choice</code> as returned by <code>size()</code>.
483:             * If the array is longer, the extra
484:             * elements are set to <code>false</code>.
485:             * 
486:             * <p>This call is valid for all types of
487:             * <code>Choices</code>. For <code>MULTIPLE</code>, any
488:             * number of elements may be selected and set to <code>true</code>
489:             * in the result
490:             * array. For <code>EXCLUSIVE</code>, <code>POPUP</code>, and
491:             * <code>IMPLICIT</code>
492:             * exactly one element will be selected (unless there are
493:             * zero elements in the <code>Choice</code>). </p>
494:             *
495:             * @param selectedArray_return array to contain the results
496:             *
497:             * @return the number of selected elements in the <code>Choice</code>
498:             *
499:             * @throws IllegalArgumentException if <code>selectedArray_return</code>
500:             * is shorter than the size of the <code>Choice</code>.
501:             * @throws NullPointerException if <code>selectedArray_return</code> is
502:             * <code>null</code>
503:             * @see #setSelectedFlags
504:             */
505:            public int getSelectedFlags(boolean[] selectedArray_return);
506:
507:            /**
508:             * For <code>MULTIPLE</code>, this simply sets an individual
509:             * element's selected
510:             * state. 
511:             *
512:             * <P>For <code>EXCLUSIVE</code> and <code>POPUP</code>,
513:             * this can be used only to select any
514:             * element, that is, the <code> selected </code> parameter must be <code>
515:             * true </code>. When an element is selected, the previously
516:             * selected element
517:             * is deselected. If <code> selected </code> is <code> false </code>, this
518:             * call is ignored. If element was already selected, the call has
519:             * no effect.</P>
520:             *
521:             * <P>For <code>IMPLICIT</code>,
522:             * this can be used only to select any
523:             * element, that is, the <code> selected </code> parameter must be <code>
524:             * true </code>. When an element is selected, the previously 
525:             * selected element
526:             * is deselected. If <code> selected </code> is <code> false </code>, this
527:             * call is ignored. If element was already selected, the call has
528:             * no effect.</P>
529:             *
530:             * <P>The call to <code>setSelectedIndex</code> does not cause
531:             * implicit activation of
532:             * any <code>Command</code>.
533:             * </P>
534:             *
535:             * <p>For all list types, the <code>elementNum</code> parameter
536:             * must be within the range
537:             * <code>[0..size()-1]</code>, inclusive. </p>
538:             * 
539:             * @param elementNum the index of the element, starting from zero
540:             * @param selected the state of the element, where <code>true</code> means
541:             * selected and <code>false</code> means not selected
542:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
543:             * @see #getSelectedIndex
544:             */
545:            public void setSelectedIndex(int elementNum, boolean selected);
546:
547:            /**
548:             * Attempts to set the selected state of every element in the
549:             * <code>Choice</code>.
550:             * The array
551:             * must be at least as long as the size of the
552:             * <code>Choice</code>. If the array is
553:             * longer, the additional values are ignored. 
554:             *
555:             * <p>For <code>Choice</code> objects of type
556:             * <code>MULTIPLE</code>, this sets the selected
557:             * state of every
558:             * element in the <code>Choice</code>. An arbitrary number of
559:             * elements may be selected.
560:             * </p>
561:             *
562:             * <p>For <code>Choice</code> objects of type
563:             * <code>EXCLUSIVE</code>, <code>POPUP</code>,
564:             * and <code>IMPLICIT</code>, exactly one array
565:             * element must have the value <code>true</code>. If no element is
566:             * <code>true</code>, the
567:             * first element
568:             * in the <code>Choice</code> will be selected. If two or more
569:             * elements are <code>true</code>, the
570:             * implementation will choose the first <code>true</code> element
571:             * and select it. </p>
572:             *
573:             * @param selectedArray an array in which the method collect the
574:             * selection status
575:             * @throws IllegalArgumentException if <code>selectedArray</code> is 
576:             * shorter than the size of the <code>Choice</code>
577:             * @throws NullPointerException if <code>selectedArray</code> is 
578:             * <code>null</code>
579:             * @see #getSelectedFlags
580:             */
581:            public void setSelectedFlags(boolean[] selectedArray);
582:
583:            /**
584:             * Sets the application's preferred policy for fitting
585:             * <code>Choice</code> element
586:             * contents to the available screen space. The set policy applies for all
587:             * elements of the <code>Choice</code> object.  Valid values are
588:             * {@link #TEXT_WRAP_DEFAULT}, {@link #TEXT_WRAP_ON},
589:             * and {@link #TEXT_WRAP_OFF}. Fit policy is a hint, and the
590:             * implementation may disregard the application's preferred policy.
591:             *
592:             * @param fitPolicy preferred content fit policy for choice elements
593:             * @throws IllegalArgumentException if <code>fitPolicy</code> is invalid
594:             * @see #getFitPolicy
595:             */
596:            public void setFitPolicy(int fitPolicy);
597:
598:            /**
599:             * Gets the application's preferred policy for fitting
600:             * <code>Choice</code> element
601:             * contents to the available screen space.  The value returned is the 
602:             * policy that had been set by the application, even if that value had 
603:             * been disregarded by the implementation.
604:             *
605:             * @return one of {@link #TEXT_WRAP_DEFAULT}, {@link #TEXT_WRAP_ON}, or
606:             * {@link #TEXT_WRAP_OFF}
607:             * @see #setFitPolicy
608:             */
609:            public int getFitPolicy();
610:
611:            /**
612:             * Sets the application's preferred font for
613:             * rendering the specified element of this <code>Choice</code>.
614:             * An element's font is a hint, and the implementation may disregard
615:             * the application's preferred font.
616:             *
617:             * <p> The <code>elementNum</code> parameter must be within the range
618:             * <code>[0..size()-1]</code>, inclusive.</p>
619:             *
620:             * <p> The <code>font</code> parameter must be a valid <code>Font</code>
621:             * object or <code>null</code>. If the <code>font</code> parameter is
622:             * <code>null</code>, the implementation must use its default font
623:             * to render the element.</p>
624:             *
625:             * @param elementNum the index of the element, starting from zero
626:             * @param font the preferred font to use to render the element
627:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
628:             * @see #getFont
629:             */
630:            public void setFont(int elementNum, Font font);
631:
632:            /**
633:             * Gets the application's preferred font for
634:             * rendering the specified element of this <code>Choice</code>. The
635:             * value returned is the font that had been set by the application,
636:             * even if that value had been disregarded by the implementation.
637:             * If no font had been set by the application, or if the application
638:             * explicitly set the font to <code>null</code>, the value is the default
639:             * font chosen by the implementation.
640:             *
641:             * <p> The <code>elementNum</code> parameter must be within the range
642:             * <code>[0..size()-1]</code>, inclusive.</p>
643:             *
644:             * @param elementNum the index of the element, starting from zero
645:             * @return the preferred font to use to render the element
646:             * @throws IndexOutOfBoundsException if <code>elementNum</code> is invalid
647:             * @see #setFont
648:             */
649:            public Font getFont(int elementNum);
650:
651:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.