Article ID: 179851
Article Last Modified on 6/14/2006
import com.ms.ui.*;
import com.ms.ui.event.*;
public class ResetUIChoiceDemo implements IUIActionListener {
UIChoice choice=null;
public ResetUIChoiceDemo(UIChoice choice) {
this.choice=choice;
}
public static void main(String args[])
{
UIFrame frame = new UIFrame("AFC Frame");
frame.setSize(320,50);
frame.setLayout(new UIGridLayout(0,2));
UIChoice choice=new UIChoice();
choice.addString("ChoiceA");
choice.addString("ChoiceB");
choice.addString("ChoiceC");
choice.addString("ChoiceD");
frame.add(choice);
UIPushButton clearButton=new UIPushButton("Clear UIChoice");
clearButton.addActionListener(new ResetUIChoiceDemo(choice));
frame.add(clearButton);
frame.setVisible(true);
}
public void actionPerformed(UIActionEvent e) {
choice.setSelectedIndex(-1); // Clear the UIChoice selection.
}
}
Keywords: kbhowto kbjafc KB179851