Java Doc for ChoiceGroup.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 Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.microedition.lcdui.Item
      javax.microedition.lcdui.ChoiceGroup

ChoiceGroup
public class ChoiceGroup extends Item implements Choice(Code)
A ChoiceGroup is a group of selectable elements intended to be placed within a Form . The group may be created with a mode that requires a single choice to be made or that allows multiple choices. The implementation is responsible for providing the graphical representation of these modes and must provide visually different graphics for different modes. For example, it might use "radio buttons" for the single choice mode and "check boxes" for the multiple choice mode.

Note: most of the essential methods have been specified in the Choice Choice interface.


since:
   MIDP 1.0

Inner Class :class CGElement

Field Summary
final static  intGROW_FACTOR
     Optimization for CGElement array size management.
 CGElement[]cgElements
     The array containing the Font of each element (null if no setFont() method was ever called).
 ChoiceGroupLFchoiceGroupLF
     The look&feel associated with this ChoiceGroup.
 intchoiceType
    
 intfitPolicy
    
 intnumOfEls
    

Constructor Summary
public  ChoiceGroup(String label, int choiceType)
     Creates a new, empty ChoiceGroup, specifying its title and its type. The type must be one of EXCLUSIVE, MULTIPLE, or POPUP.
public  ChoiceGroup(String label, int choiceType, String[] stringElements, Image[] imageElements)
     Creates a new ChoiceGroup, specifying its title, the type of the ChoiceGroup, and an array of Strings and Images to be used as its initial contents.

The type must be one of EXCLUSIVE, MULTIPLE, or POPUP.

 ChoiceGroup(String label, int choiceType, String[] stringElements, Image[] imageElements, boolean implicitAllowed)
    

Method Summary
 booleanacceptFocus()
     Return whether the Item takes user input focus.
public  intappend(String stringPart, Image imagePart)
     Appends an element to the ChoiceGroup.
public  voiddelete(int elementNum)
     Deletes the element referenced by elementNum.
public  voiddeleteAll()
     Deletes all elements from this ChoiceGroup.
public  intgetFitPolicy()
     Gets the application's preferred policy for fitting Choice element contents to the available screen space.
public  FontgetFont(int elementNum)
     Gets the application's preferred font for rendering the specified element of this Choice.
public  ImagegetImage(int elementNum)
     Gets the Image part of the element referenced by elementNum.
 Image[]getImageElements()
    
public  intgetSelectedFlags(boolean[] selectedArray_return)
     Queries the state of a ChoiceGroup and returns the state of all elements in the boolean array selectedArray_return.
public  intgetSelectedIndex()
     Returns the index number of an element in the ChoiceGroup that is selected.
public  StringgetString(int elementNum)
     Gets the String part of the element referenced by elementNum.
 String[]getStringElements()
    
public  voidinsert(int elementNum, String stringPart, Image imagePart)
     Inserts an element into the ChoiceGroup just prior to the element specified.
public  booleanisSelected(int elementNum)
     Gets a boolean value indicating whether this element is selected.
public  voidset(int elementNum, String stringPart, Image imagePart)
     Sets the String and Image parts of the element referenced by elementNum, replacing the previous contents of the element.
public  voidsetFitPolicy(int fitPolicy)
     Sets the application's preferred policy for fitting Choice element contents to the available screen space.
public  voidsetFont(int elementNum, Font font)
     Sets the application's preferred font for rendering the specified element of this Choice. An element's font is a hint, and the implementation may disregard the application's preferred font.

The elementNum parameter must be within the range [0..size()-1], inclusive.

The font parameter must be a valid Font object or null.

public  voidsetSelectedFlags(boolean[] selectedArray)
     Attempts to set the selected state of every element in the ChoiceGroup.
public  voidsetSelectedIndex(int elementNum, boolean selected)
     For ChoiceGroup objects of type MULTIPLE, this simply sets an individual element's selected state.

For ChoiceGroup objects of type EXCLUSIVE and POPUP, this can be used only to select an element.

public  intsize()
     Returns the number of elements in the ChoiceGroup.

Field Detail
GROW_FACTOR
final static int GROW_FACTOR(Code)
Optimization for CGElement array size management. Notice that cgElements.length is not equal to numOfEls. Use numOfEls only when accessing the array.



cgElements
CGElement[] cgElements(Code)
The array containing the Font of each element (null if no setFont() method was ever called). If fontEls is non-null, only the elements which were set by setFont() are non-null.



choiceGroupLF
ChoiceGroupLF choiceGroupLF(Code)
The look&feel associated with this ChoiceGroup. Set in the constructor.



choiceType
int choiceType(Code)
The type of this ChoiceGroup



fitPolicy
int fitPolicy(Code)
The string fit policy for this ChoiceGroup '0' by default, which is Choice.TEXT_WRAP_DEFAULT



numOfEls
int numOfEls(Code)
The number of elements in this ChoiceGroup




Constructor Detail
ChoiceGroup
public ChoiceGroup(String label, int choiceType)(Code)
Creates a new, empty ChoiceGroup, specifying its title and its type. The type must be one of EXCLUSIVE, MULTIPLE, or POPUP. The IMPLICIT choice type is not allowed within a ChoiceGroup.
Parameters:
  label - the item's label (see Item Item)
Parameters:
  choiceType - EXCLUSIVE, MULTIPLE,or POPUP
throws:
  IllegalArgumentException - if choiceType is not one ofEXCLUSIVE, MULTIPLE, or POPUP
See Also:   Choice.EXCLUSIVE
See Also:   Choice.MULTIPLE
See Also:   Choice.IMPLICIT
See Also:   Choice.POPUP



ChoiceGroup
public ChoiceGroup(String label, int choiceType, String[] stringElements, Image[] imageElements)(Code)
Creates a new ChoiceGroup, specifying its title, the type of the ChoiceGroup, and an array of Strings and Images to be used as its initial contents.

The type must be one of EXCLUSIVE, MULTIPLE, or POPUP. The IMPLICIT type is not allowed for ChoiceGroup.

The stringElements array must be non-null and every array element must also be non-null. The length of the stringElements array determines the number of elements in the ChoiceGroup. The imageElements array may be null to indicate that the ChoiceGroup elements have no images. If the imageElements array is non-null, it must be the same length as the stringElements array. Individual elements of the imageElements array may be null in order to indicate the absence of an image for the corresponding ChoiceGroup element. Non-null elements of the imageElements array may refer to mutable or immutable images.


Parameters:
  label - the item's label (see Item Item)
Parameters:
  choiceType - EXCLUSIVE, MULTIPLE,or POPUP
Parameters:
  stringElements - set of strings specifying the string parts of theChoiceGroup elements
Parameters:
  imageElements - set of images specifying the image parts ofthe ChoiceGroup elements
throws:
  NullPointerException - if stringElementsis null
throws:
  NullPointerException - if the stringElementsarray containsany null elements
throws:
  IllegalArgumentException - if the imageElementsarray is non-nulland has a different length from the stringElements array
throws:
  IllegalArgumentException - if choiceType is not one ofEXCLUSIVE, MULTIPLE, or POPUP
See Also:   Choice.EXCLUSIVE
See Also:   Choice.MULTIPLE
See Also:   Choice.IMPLICIT
See Also:   Choice.POPUP



ChoiceGroup
ChoiceGroup(String label, int choiceType, String[] stringElements, Image[] imageElements, boolean implicitAllowed)(Code)
Special constructor used by List
Parameters:
  label - the item's label (see Item Item)
Parameters:
  choiceType - EXCLUSIVE or MULTIPLE
Parameters:
  stringElements - set of strings specifying the string parts of theChoiceGroup elements
Parameters:
  imageElements - set of images specifying the image parts ofthe ChoiceGroup elements
Parameters:
  implicitAllowed - Flag to allow implicit selection
throws:
  NullPointerException - if stringElements is null
throws:
  NullPointerException - if the stringElements array containsany null elements
throws:
  IllegalArgumentException - if the imageElements array is non-nulland has a different length from the stringElements array
throws:
  IllegalArgumentException - if choiceType is neitherEXCLUSIVE nor MULTIPLE
throws:
  IllegalArgumentException - if any image in the imageElementsarray is mutable
See Also:   Choice.EXCLUSIVE
See Also:   Choice.MULTIPLE
See Also:   Choice.IMPLICIT




Method Detail
acceptFocus
boolean acceptFocus()(Code)
Return whether the Item takes user input focus. return true if contents is not null or haveabstract commands.



append
public int append(String stringPart, Image imagePart)(Code)
Appends an element to the ChoiceGroup.
Parameters:
  stringPart - the string part of the element to be added
Parameters:
  imagePart - the image part of the element to be added, ornull if there is no image part the assigned index of the element
throws:
  NullPointerException - if stringPart isnull



delete
public void delete(int elementNum)(Code)
Deletes the element referenced by elementNum.
Parameters:
  elementNum - the index of the element to be deleted
throws:
  IndexOutOfBoundsException - if elementNum is invalid



deleteAll
public void deleteAll()(Code)
Deletes all elements from this ChoiceGroup.



getFitPolicy
public int getFitPolicy()(Code)
Gets the application's preferred policy for fitting Choice element contents to the available screen space. The value returned is the policy that had been set by the application, even if that value had been disregarded by the implementation. one of ChoiceGroup.TEXT_WRAP_DEFAULT, ChoiceGroup.TEXT_WRAP_ON, orChoiceGroup.TEXT_WRAP_OFF
See Also:   ChoiceGroup.setFitPolicy



getFont
public Font getFont(int elementNum)(Code)
Gets the application's preferred font for rendering the specified element of this Choice. The value returned is the font that had been set by the application, even if that value had been disregarded by the implementation. If no font had been set by the application, or if the application explicitly set the font to null, the value is the default font chosen by the implementation.

The elementNum parameter must be within the range [0..size()-1], inclusive.


Parameters:
  elementNum - the index of the element, starting from zero the preferred font to use to render the element
throws:
  IndexOutOfBoundsException - if elementNum is invalid
See Also:   ChoiceGroup.setFont(int elementNum,Font font)



getImage
public Image getImage(int elementNum)(Code)
Gets the Image part of the element referenced by elementNum.
Parameters:
  elementNum - the number of the element to be queried the image part of the element, or null if there is no image
throws:
  IndexOutOfBoundsException - if elementNum is invalid
See Also:   ChoiceGroup.getString(int)



getImageElements
Image[] getImageElements()(Code)
Helper method, used solely by the native method call: updatePopupElements() an array of image elements



getSelectedFlags
public int getSelectedFlags(boolean[] selectedArray_return)(Code)
Queries the state of a ChoiceGroup and returns the state of all elements in the boolean array selectedArray_return. Note: this is a result parameter. It must be at least as long as the size of the ChoiceGroup as returned by size(). If the array is longer, the extra elements are set to false.

For ChoiceGroup objects of type MULTIPLE, any number of elements may be selected and set to true in the result array. For ChoiceGroup objects of type EXCLUSIVE and POPUP exactly one element will be selected, unless there are zero elements in the ChoiceGroup.

the number of selected elements in the ChoiceGroup
Parameters:
  selectedArray_return - array to contain the results
throws:
  IllegalArgumentException - if selectedArray_returnis shorter than the size of the ChoiceGroup
throws:
  NullPointerException - if selectedArray_returnis null
See Also:   ChoiceGroup.setSelectedFlags



getSelectedIndex
public int getSelectedIndex()(Code)
Returns the index number of an element in the ChoiceGroup that is selected. For ChoiceGroup objects of type EXCLUSIVE and POPUP there is at most one element selected, so this method is useful for determining the user's choice. Returns -1 if there are no elements in the ChoiceGroup.

For ChoiceGroup objects of type MULTIPLE, this always returns -1 because no single value can in general represent the state of such a ChoiceGroup. To get the complete state of a MULTIPLE Choice, see ChoiceGroup.getSelectedFlags getSelectedFlags .

index of selected element, or -1 if none
See Also:   ChoiceGroup.setSelectedIndex



getString
public String getString(int elementNum)(Code)
Gets the String part of the element referenced by elementNum.
Parameters:
  elementNum - the index of the element to be queried the string part of the element
throws:
  IndexOutOfBoundsException - if elementNum is invalid
See Also:   ChoiceGroup.getImage(int)



getStringElements
String[] getStringElements()(Code)
Helper method, used solely by the native method call: updatePopupElements() an array of string elements



insert
public void insert(int elementNum, String stringPart, Image imagePart)(Code)
Inserts an element into the ChoiceGroup just prior to the element specified.
Parameters:
  elementNum - the index of the element where insertion is to occur
Parameters:
  stringPart - the string part of the element to be inserted
Parameters:
  imagePart - the image part of the element to be inserted,or null if there is no image part
throws:
  IndexOutOfBoundsException - if elementNum is invalid
throws:
  NullPointerException - if stringPartis null



isSelected
public boolean isSelected(int elementNum)(Code)
Gets a boolean value indicating whether this element is selected.
Parameters:
  elementNum - the index of the element to be queried selection state of the element
throws:
  IndexOutOfBoundsException - if elementNum is invalid



set
public void set(int elementNum, String stringPart, Image imagePart)(Code)
Sets the String and Image parts of the element referenced by elementNum, replacing the previous contents of the element.
Parameters:
  elementNum - the index of the element to be set
Parameters:
  stringPart - the string part of the new element
Parameters:
  imagePart - the image part of the element, or nullif there is no image part
throws:
  IndexOutOfBoundsException - if elementNum is invalid
throws:
  NullPointerException - if stringPart isnull



setFitPolicy
public void setFitPolicy(int fitPolicy)(Code)
Sets the application's preferred policy for fitting Choice element contents to the available screen space. The set policy applies for all elements of the Choice object. Valid values are ChoiceGroup.TEXT_WRAP_DEFAULT , ChoiceGroup.TEXT_WRAP_ON , and ChoiceGroup.TEXT_WRAP_OFF . Fit policy is a hint, and the implementation may disregard the application's preferred policy.
Parameters:
  fitPolicy - preferred content fit policy for choice elements
throws:
  IllegalArgumentException - if fitPolicy is invalid
See Also:   ChoiceGroup.getFitPolicy



setFont
public void setFont(int elementNum, Font font)(Code)
Sets the application's preferred font for rendering the specified element of this Choice. An element's font is a hint, and the implementation may disregard the application's preferred font.

The elementNum parameter must be within the range [0..size()-1], inclusive.

The font parameter must be a valid Font object or null. If the font parameter is null, the implementation must use its default font to render the element.


Parameters:
  elementNum - the index of the element, starting from zero
Parameters:
  font - the preferred font to use to render the element
throws:
  IndexOutOfBoundsException - if elementNum is invalid
See Also:   ChoiceGroup.getFont



setSelectedFlags
public void setSelectedFlags(boolean[] selectedArray)(Code)
Attempts to set the selected state of every element in the ChoiceGroup. The array must be at least as long as the size of the ChoiceGroup. If the array is longer, the additional values are ignored.

For ChoiceGroup objects of type MULTIPLE, this sets the selected state of every element in the Choice. An arbitrary number of elements may be selected.

For ChoiceGroup objects of type EXCLUSIVE and POPUP, exactly one array element must have the value true. If no element is true, the first element in the Choice will be selected. If two or more elements are true, the implementation will choose the first true element and select it.


Parameters:
  selectedArray - an array in which the method collect theselection status
throws:
  IllegalArgumentException - if selectedArrayis shorter than the size of the ChoiceGroup
throws:
  NullPointerException - if the selectedArrayis null
See Also:   ChoiceGroup.getSelectedFlags




setSelectedIndex
public void setSelectedIndex(int elementNum, boolean selected)(Code)
For ChoiceGroup objects of type MULTIPLE, this simply sets an individual element's selected state.

For ChoiceGroup objects of type EXCLUSIVE and POPUP, this can be used only to select an element. That is, the selected parameter must be true . When an element is selected, the previously selected element is deselected. If selected is false , this call is ignored.

For both list types, the elementNum parameter must be within the range [0..size()-1], inclusive.


Parameters:
  elementNum - the number of the element. Indexing of theelements is zero-based
Parameters:
  selected - the new state of the element true=selected,false=not selected
throws:
  IndexOutOfBoundsException - if elementNum is invalid
See Also:   ChoiceGroup.getSelectedIndex



size
public int size()(Code)
Returns the number of elements in the ChoiceGroup. the number of elements in the ChoiceGroup



Fields inherited from javax.microedition.lcdui.Item
final public static int BUTTON(Code)(Java Doc)
final public static int HYPERLINK(Code)(Java Doc)
final public static int LAYOUT_2(Code)(Java Doc)
final public static int LAYOUT_BOTTOM(Code)(Java Doc)
final public static int LAYOUT_CENTER(Code)(Java Doc)
final public static int LAYOUT_DEFAULT(Code)(Java Doc)
final public static int LAYOUT_EXPAND(Code)(Java Doc)
final public static int LAYOUT_LEFT(Code)(Java Doc)
final public static int LAYOUT_NEWLINE_AFTER(Code)(Java Doc)
final public static int LAYOUT_NEWLINE_BEFORE(Code)(Java Doc)
final public static int LAYOUT_RIGHT(Code)(Java Doc)
final public static int LAYOUT_SHRINK(Code)(Java Doc)
final public static int LAYOUT_TOP(Code)(Java Doc)
final public static int LAYOUT_VCENTER(Code)(Java Doc)
final public static int LAYOUT_VEXPAND(Code)(Java Doc)
final public static int LAYOUT_VSHRINK(Code)(Java Doc)
final public static int PLAIN(Code)(Java Doc)
final static int VALID_LAYOUT(Code)(Java Doc)
ItemCommandListener commandListener(Code)(Java Doc)
Command commands(Code)(Java Doc)
Command defaultCommand(Code)(Java Doc)
ItemLF itemLF(Code)(Java Doc)
String label(Code)(Java Doc)
int layout(Code)(Java Doc)
int lockedHeight(Code)(Java Doc)
int lockedWidth(Code)(Java Doc)
int numCommands(Code)(Java Doc)
Screen owner(Code)(Java Doc)
int userPreferredHeight(Code)(Java Doc)
int userPreferredWidth(Code)(Java Doc)

Methods inherited from javax.microedition.lcdui.Item
boolean acceptFocus()(Code)(Java Doc)
public void addCommand(Command cmd)(Code)(Java Doc)
ItemLF getLF()(Code)(Java Doc)
public String getLabel()(Code)(Java Doc)
public int getLayout()(Code)(Java Doc)
public int getMinimumHeight()(Code)(Java Doc)
public int getMinimumWidth()(Code)(Java Doc)
public int getPreferredHeight()(Code)(Java Doc)
public int getPreferredWidth()(Code)(Java Doc)
void itemDeleted()(Code)(Java Doc)
void lSetOwner(Screen owner)(Code)(Java Doc)
void lUpdateLockedSize()(Code)(Java Doc)
public void notifyStateChanged()(Code)(Java Doc)
public void removeCommand(Command cmd)(Code)(Java Doc)
void removeCommandImpl(Command cmd)(Code)(Java Doc)
public void setDefaultCommand(Command cmd)(Code)(Java Doc)
public void setItemCommandListener(ItemCommandListener l)(Code)(Java Doc)
public void setLabel(String label)(Code)(Java Doc)
public void setLayout(int layout)(Code)(Java Doc)
void setLayoutImpl(int layout)(Code)(Java Doc)
public void setPreferredSize(int width, int height)(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.