import java.awt.*;
import java.applet.Applet;
public class UseList2 extends Applet
{
	Label lb = new Label ("Select One", Label.CENTER);
  	Choice ch = new Choice ();
 	Button bt1 = new Button ("Submit");
  	Button bt2 = new Button ("Cancel");
  	public void init()
  	{
		ch.addItem ("Nikhil");
		ch.addItem ("Sanath");
		ch.addItem ("Praveen");
		ch.addItem ("hello");
		add (lb);
		add (ch);
		add (bt1); add (bt2);
  	}
	public void paint(Graphics g)
	{
		int x=0,y=0,z=0;
		String s1,s2,s;
		g.drawString("Number of items in the list ",10,50);
		try
		{
  			x=ch.getItemCount();
  			s=String.valueOf(x); 
  			g.drawString(s,200,50);
		}
		catch (Exception ex) {}

	}

}  

Click here to go back.

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus

Footer1