import java.awt.*;
import java.applet.Applet;
/* <applet code="checkboxes" width=200 height=300 >
</applet>
*/
public class checkboxes extends Applet
{
Checkbox cb;
public void init()
{
String [] fonts;
fonts = Toolkit.getDefaultToolkit().getFontList();
add( cb = new Checkbox ( fonts[0]));
CheckboxGroup cbg = new CheckboxGroup();
Panel p = new Panel();
p.setLayout(new GridLayout(0,1));
for ( int i=1 ; i<fonts.length ; i++)
{
p.add(new Checkbox(fonts[i] , cbg, false));
}
add(p);
}
public boolean action (Event e,Object o)
{
if(e.target==cb)
{
if("true".equals(o.toString()))
cb.setLabel("true");
else
cb.setLabel("false");
}
return false;
}
}
import java.applet.Applet;
/* <applet code="checkboxes" width=200 height=300 >
</applet>
*/
public class checkboxes extends Applet
{
Checkbox cb;
public void init()
{
String [] fonts;
fonts = Toolkit.getDefaultToolkit().getFontList();
add( cb = new Checkbox ( fonts[0]));
CheckboxGroup cbg = new CheckboxGroup();
Panel p = new Panel();
p.setLayout(new GridLayout(0,1));
for ( int i=1 ; i<fonts.length ; i++)
{
p.add(new Checkbox(fonts[i] , cbg, false));
}
add(p);
}
public boolean action (Event e,Object o)
{
if(e.target==cb)
{
if("true".equals(o.toString()))
cb.setLabel("true");
else
cb.setLabel("false");
}
return false;
}
}
No comments:
Post a Comment