Saturday 30 June 2012

program to demostrate used of choice box using applet.

import java.awt.*;
import java.applet.Applet;

/* <applet code="choicebox" width=200 height=300 >
   </applet>
*/

public class choicebox extends Applet
{
      public void init()
      {
            String [] fonts;
            fonts = Toolkit.getDefaultToolkit().getFontList();

            Choice c = new Choice();           
            Choice b = new Choice();
           
            for ( int i=1 ; i<fonts.length ; i++)
            {
                  c.addItem(fonts[i]);
                  b.addItem(fonts[i]);
            }
            add(c);
            add(b);
       }
}

No comments:

Post a Comment