import java.awt.*; import java.util.*; import java.io.*; public class Kell3 extends Frame{ int t, m; public Kell3(int tunnid, int minutid){ setTitle("Kellake"); setSize(400, 400); t=tunnid; m=minutid; setVisible(true); } public void paint(Graphics g){ g.setColor(Color.yellow); g.fillOval(100, 100, 200, 200); g.setColor(Color.black); g.drawOval(100, 100, 200, 200); g.drawOval(195, 195, 5, 5); g.drawString("Praegu on kell: ", 50, 30); Calendar kalender=new GregorianCalendar(); int tpraegu=kalender.get(Calendar.HOUR); int mpraegu=kalender.get(Calendar.MINUTE); g.drawString("Tunnid: "+tpraegu+"", 50, 50); g.drawString("Minutid: "+mpraegu+"", 50, 70); g.drawString("Soovid aratust kell "+t+""+":"+m+"", 50, 90); if(tpraegu==t)g.drawString("ARATUS!", 200, 50); int minpraegu=mpraegu/5; int min=m/5; int x=233; int y=133; for(int i=1; i<6; i++){ if(i==tpraegu)g.drawLine(200, 200, x, y); if(i==minpraegu)g.drawLine(200, 200, x, y); g.drawString(i+"", x, y); y=y+33; if(i>=3)x=x-33; if(i<3)x=x+33; } x=200; y=300; g.drawString("6", x, y); if(t==6)g.drawLine(200, 200, x, y); if(minpraegu==6)g.drawLine(200, 200, x, y); for(int k=7; k<13; k++){ y=y-33; if(k<=9)x=x-33; if(k>9)x=x+33; g.drawString(k+"", x, y); if(k==tpraegu)g.drawLine(200, 200, x, y); if(k==minpraegu)g.drawLine(200, 200, x, y); } } public static void main(String argumendid[]) throws Exception{ int tunnid; int minutid; String s; PrintWriter valja=new PrintWriter(System.out, true); BufferedReader sisse=new BufferedReader( new InputStreamReader(System.in) ); valja.println("Sisesta tunnid, millal soovid aratust:"); s=sisse.readLine(); tunnid=Integer.valueOf(s).intValue(); valja.println("Sisesta minutid:"); s=sisse.readLine(); minutid=Integer.valueOf(s).intValue(); new Kell3(tunnid, minutid); } }