import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*<applet code="Ex63.java" width=500 height=400></applet>*/
public class Ex63 extends Applet
{
MyChoice choice;
public void init()
{
choice=new MyChoice();
choice.add("Red");
choice.add("Green");
choice.add("Blue");
add(choice);
}
class MyChoice extends Choice
{
public MyChoice()
{
enableEvents(AWTEvent.ITEM_EVENT_MASK);
}
protected void processItemEvent(ItemEvent ie)
{
showStatus("Choice selection:"+getSelectedItem());
super.processItemEvent(ie);
}
}
}
import java.awt.*;
import java.awt.event.*;
/*<applet code="Ex63.java" width=500 height=400></applet>*/
public class Ex63 extends Applet
{
MyChoice choice;
public void init()
{
choice=new MyChoice();
choice.add("Red");
choice.add("Green");
choice.add("Blue");
add(choice);
}
class MyChoice extends Choice
{
public MyChoice()
{
enableEvents(AWTEvent.ITEM_EVENT_MASK);
}
protected void processItemEvent(ItemEvent ie)
{
showStatus("Choice selection:"+getSelectedItem());
super.processItemEvent(ie);
}
}
}
No comments:
Post a Comment