Name
ChoiceCallback
Synopsis
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); }
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.