ChoiceCallback


ChoiceCallback javax.security.auth.callback

Java 1.4 serializable

A Callback of this type represents a request to display set of text choices and allow the user to select one or more of them. A CallbackHandler , should display the prompt returned by getPrompt( ) and also the strings returned by getChoices( ) . If allowMultipleSelections( ) is true , then it should allow the user to select zero or more; otherwise , it should only allow the user to select a single one. In either case, the CallbackHandler should also call geTDefaultChoice( ) and make the choice at the returned index the default choice. When the user has made her selection, the CallbackHandler should pass the index of a single selection to setSelectedIndex( ) , or the indexes of multiple selections to setSelectedIndexes( ) .

Figure 19-6. javax.security.auth.callback.ChoiceCallback

 public class  ChoiceCallback  implements Callback, Serializable {  // Public Constructors  public  ChoiceCallback  (String  prompt  , String[ ]  choices  , int  defaultChoice  ,          boolean  multipleSelectionsAllowed  );  // Public Instance Methods  public boolean  allowMultipleSelections  ( );        public String[ ]  getChoices  ( );        public int  getDefaultChoice  ( );        public String  getPrompt  ( );        public int[ ]  getSelectedIndexes  ( );        public void  setSelectedIndex  (int  selection  );        public void  setSelectedIndexes  (int[ ]  selections  );   } 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net