To implement a shape selector from a given set of shapes
import java.awt.*; import java.awt.event.*; import java.applet.*; public class shape extend Applet implements itemListener { Chekbox reet,circle,line; ChekboxGroup cbg; String msg; String s1="reet"; String s2="circle"; string s3="line"; publice void init() { cbg=new checkboxGroup(); rect = new checkbox("reet,cbg,tru); circle = new Checkbox("circle",cbg.false); line = new Checkbox("line",cbg,false); add(reet); add(circle); add(line); rect.addItemListener(this); circle.addItemLisener(this); line.addItemListener(this); } public void item StateChanged(ItemEvent ie) { repaint(); } publice void paint(Graphics g) { msg=cbg.getSlectedCheckbox().getLabel(); if(masg.compareTo(s1)==0) { g.drawRect(10,40,40,80); } else if(msg.compareTo(s2)==0) { g.drawOvel(10,40,80,80); } else { g.drawLine(0,0,100,100); } } }
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya
April 14th, 2011 at 9:48 pm
Nel caso che il profumo che stai cercando non c’è fra i 1700 prodotti che offriamo su questa pagina web, puoi scriverci al nostro e-mail, comunicandoci il nome del profumo che stai cercando. Ci impegneremo a reperirlo per te nei tempi più brevi possibili, l’unica eccezione sono i profumi di classe inferiore.
September 3rd, 2011 at 8:24 pm
Often time the garden shed plans are not as involved as the plans for larger sheds.