/*
Disable AWT Choice Or Combobox Example
This java example shows how to disable a choice or combobox using Java AWT
Choice class.
*/
import java.applet.Applet;
import java.awt.Choice;
/*
<applet code="DisableChoiceExample" width=200 height=200>
</applet>
*/
public class DisableChoiceExample extends Applet{
Choice language = null;
public void init(){
//create choice or combobox
language = new Choice();
//add items to the choice
language.add("Java");
language.add("C++");
language.add("VB");
language.add("Perl");
//add choice or combobox
add(language);
/*
* To disable choice or a combobox, use
* void setEnabled(boolean enable)
* method.
*/
language.setEnabled(false);
}
}
Example Output

Bookmark/Search this post with: