Programalama > JAVA - JSP

Etiketler: java, harika, bir, saat

Ort. 0
Puan ver:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import java.applet.*;
import java.awt.*;
import java.util.*;
 
public class saat extends Applet implements Runnable {      
     
        Thread Clock_animation;
        private Image Buffer;
        private Graphics gBuffer;  
        int oldSec,sec,min,hour,day,date,month,counter;
        double pi = 3.14159;
        double pi2 = 2 * pi;
        String second,minute,hours;
         
        String weekday;String Smonth;
        Font a = new Font("Helvetica", Font.ITALIC,24);
        Font b = new Font("Helvetica", Font.PLAIN,14);     
        Font c = new Font("Helvetica", Font.PLAIN,18); 
 
        Color c1 = new Color(200,200,160);
        Color c2 = new Color(0,120,70);    
 
        public void init() {           
             
            oldSec=-1;
             
                Buffer=createImage(size().width,size().height);
                gBuffer=Buffer.getGraphics();              
 
        }      
         
         
        public void start() {
                if (Clock_animation == null) {
                        Clock_animation = new Thread (this);
                        Clock_animation.start();
                }
        }
        public void stop() {
                if (Clock_animation != null) {
                        Clock_animation.stop();
                        Clock_animation = null;
                }
        }
 
        public void run() {
             
                while (true)
                {                  
                    try  {Clock_animation.sleep (50);}
                         catch (Exception e) { }                           
                        repaint(); 
                         
                        Date d=new Date();
            sec=d.getSeconds();            
 
            if(sec!=oldSec){
                         
                gBuffer.setColor(Color.blue);  
            gBuffer.setFont(a);
            gBuffer.drawString(":",54,83);
            gBuffer.drawString(":",88,83); 
            oldSec=sec;
            try  {Clock_animation.sleep (399);}
                         catch (Exception e) { }                           
                        repaint(); 
                         
            }  
             
            min=d.getMinutes();
            hour=d.getHours();
            day=d.getDay();
            date=d.getDate();
            month=d.getMonth();
             
            gBuffer.setColor(c1);  
            gBuffer.setFont(a);
            gBuffer.drawString(":",54,83);
            gBuffer.drawString(":",88,83); 
             
            try  {Clock_animation.sleep (599);}
                         catch (Exception e) { }                           
                        repaint();
 
            gBuffer.setColor(c1);
            gBuffer.fill3DRect(0,0,150,180,true);
            gBuffer.fill3DRect(5,5,140,142,true);  
            gBuffer.fill3DRect(5,150,140,25,true);
             
            gBuffer.setColor(Color.yellow);
            gBuffer.drawOval(16,16,118,118);
             
            gBuffer.setFont(a);        
 
            gBuffer.setColor(Color.blue);
     
            if(hour<10)
                hours="0"+hour;        
            else
                hours=""+hour;
 
            if(min<10)
                minute="0"+min;        
            else
                minute=""+min;
 
            if(sec<10)
                second="0"+sec;        
            else
                second=""+sec;
 
            gBuffer.drawString(hours+" "+minute+" "+second,28,85);
            gBuffer.setColor(Color.green);
            gBuffer.drawString("Talip",50,60);
            gBuffer.drawString("Ozturk",40,105);
            switch(day){
            case 0: weekday="Pazar"; break;
            case 1: weekday="Pazartesi"; break;
            case 2: weekday="Sali"; break;
            case 3: weekday="Carsamba"; break;
            case 4: weekday="Persembe"; break;
            case 5: weekday="Cuma"; break;
            case 6: weekday="Cumartesi"; break;
            }
            gBuffer.setColor(Color.red);
            gBuffer.setFont(b);
            gBuffer.drawString(weekday,22,168);
 
            gBuffer.setFont(c);
            gBuffer.setColor(c2);
            if(date>9)
            gBuffer.drawString(""+date,64,169);
            else           
                gBuffer.drawString("0"+date,64,169);               
             
             
            switch(month){
            case 0: Smonth="Ocak"; break;
            case 1: Smonth="Subat"; break;
            case 2: Smonth="Mart"; break;
            case 3: Smonth="Nisan"; break;
            case 4: Smonth="Mayis"; break;
            case 5: Smonth="Haziran"; break;
            case 6: Smonth="Temmuz"; break;
            case 7: Smonth="Agustos"; break;
            case 8: Smonth="Eylul"; break;
            case 9: Smonth="Ekim"; break;
            case 10: Smonth="Kasim"; break;
            case 11: Smonth="Aralik"; break;
 
            }
            gBuffer.setFont(b);
            gBuffer.setColor(Color.red);
            gBuffer.drawString(Smonth,105,168);
 
            double sv = sec * pi2 / 60.0;
            int sx=(int)(70+59*Math.sin(sv));
            int sy=(int)(70-59*Math.cos(sv));          
            gBuffer.fillOval (sx,sy,10,10);
            }              
        }
 
        public void update(Graphics g) {
               paint(g);
        }
         
        public void paint(Graphics g) {
            g.drawImage (Buffer,0,0, this);            
        }
}


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2025 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.