animasi  pada  JA dilakukan  progra
delay.
G.Umpan Balik
1. Apakah  saud yang  dibuat
kompetensin 2. Apakah saud
yang  dibuat kompetensin
3. Apakah  saud gambar  yan
pencapaian k
H. Kunci Jawaban 1. Source Code
package tugas3_jamanalog ;
import java .
awt .;
import java .
awt .
event .;
import java .
util .
Calendar ;
import java .
util .
Random ;
publicclass Tugas3_JamAnalog extends Frame
{
privateint PusatX
, PusatY
, xorR
, xorG
, xorB
;
Random Rdm ;
public Tugas3_JamAnalog
{
super Jam
;
setLayout new
FlowLayout ;
setSize 800
, 600
;
addWindowListener new
WindowListener {
publicvoid windowActivated
WindowEvent e {}
publicvoid windowClosed
WindowEvent e {}
publicvoid windowClosing
WindowEvent e {
System .
exit ;
}
publicvoid windowDeactivated
WindowEvent e {}
publicvoid windowDeiconified
WindowEvent e {}
publicvoid windowIconified
WindowEvent e {}
publicvoid windowOpened
WindowEvent e {}
};
Rdm =
new java
. util
. Random
;
setBackground Color
. white
;
JAVA  dengan  langsung  menentukan  pro ram  dan  berapa  lama  waktu  tunggu  menuju
Balik dan Tindak Lanjut
saudara  sudah  mampu  memberikan  aksi  rotas at  dari  kelas  Graphicdan  berapa  prosen  ting
sinya? udara sudah mampu memberikan aksi transla
at  dari  kelas  Graphicdan  berapa  prosen  ting sinya?
saudara  sudah  mampu  memberikan  pengubah ang  dibuat  dari  kelas  Graphicdan  berapa
n kompetensinya?
aban ode Program
package tugas3_jamanalog ;
import java .
awt .;
import java .
awt .
event .;
import java .
util .
Calendar ;
import java .
util .
Random ;
publicclass Tugas3_JamAnalog extends Frame
{
privateint PusatX
, PusatY
, xorR
, xorG
, xorB
;
Random Rdm ;
public Tugas3_JamAnalog
{
super Jam
;
setLayout new
FlowLayout ;
setSize 800
, 600
;
addWindowListener new
WindowListener {
publicvoid windowActivated
WindowEvent e {}
publicvoid windowClosed
WindowEvent e {}
publicvoid windowClosing
WindowEvent e {
System .
exit ;
}
publicvoid windowDeactivated
WindowEvent e {}
publicvoid windowDeiconified
WindowEvent e {}
publicvoid windowIconified
WindowEvent e {}
publicvoid windowOpened
WindowEvent e {}
};
Rdm =
new java
. util
. Random
;
setBackground Color
. white
;
125 roses  apa  yang
ju  proses  tersebut
tasi  pada  gambar ingkat  pencapaian
slasi pada gambar ingkat  pencapaian
ahan  skala pada a  prosen  tingkat
package tugas3_jamanalog ;
import java .
awt .;
import java .
awt .
event .;
import java .
util .
Calendar ;
import java .
util .
Random ;
publicclass Tugas3_JamAnalog extends Frame
{
privateint PusatX
, PusatY
, xorR
, xorG
, xorB
;
Random Rdm ;
public Tugas3_JamAnalog
{
super Jam
;
setLayout new
FlowLayout ;
setSize 800
, 600
;
addWindowListener new
WindowListener {
publicvoid windowActivated
WindowEvent e {}
publicvoid windowClosed
WindowEvent e {}
publicvoid windowClosing
WindowEvent e {
System .
exit ;
}
publicvoid windowDeactivated
WindowEvent e {}
publicvoid windowDeiconified
WindowEvent e {}
publicvoid windowIconified
WindowEvent e {}
publicvoid windowOpened
WindowEvent e {}
};
Rdm =
new java
. util
. Random
;
setBackground Color
. white
;
126
new javax
. swing
. Timer
1000 ,
new ActionListener
{ mengatur
kecepatan detik 1 detik 1000 ms publicvoid
actionPerformed ActionEvent ev
{
repaint ;
PusatX =
getWidth 2
;
PusatY =
getHeight 2
;
xorR =
Rdm .
nextInt 255
;
xorG =
Rdm .
nextInt 255
;
xorB =
Rdm .
nextInt 255
; }
}. start
; }
publicstaticvoid main String
[] a
{ new
Tugas3_JamAnalog .
setVisible true
; }
publicvoid paint
Graphics G {
G .
setColor Color
. black
; warna jam
int pjg
; if
getWidth getHeight
pjg =
getWidth -
100 ;
else pjg
= getHeight
- 100
; G
. drawOval
PusatX -
pjg 2
, PusatY
- pjg
2 ,
pjg ,
pjg ;
for int
I= 1
;I= 12
;I++{ G
. fillOval
int PusatX
+ Math
. sin
30 Math
. PI
I 180
pjg 2
, int
PusatY +
Math .
cos 30
Math .
PI I
180 -
1 pjg
2 ,
5 ,
5 ;
G .
drawString +
I ,
int PusatX
+ Math
. sin
30 Math
. PI
I 180
pjg 2
.2 ,
int PusatY
+ Math
. cos
30 Math
. PI
I 180
- 1
pjg 2.2
; }
float Detik
= Waktu
Calendar .
SECOND +
float Waktu
Calendar .
MILLISECOND 1000
; G
. drawLine
PusatX ,
PusatY ,
int PusatX
+ Math
. sin
2 Math
. PI
Detik 60
pjg 2
, int
PusatY +-
1 Math
. cos
2 Math
. PI
Detik 60
pjg 2
;
float Menit
= Waktu
Calendar .
MINUTE +
float Detik
60 ;
G .
drawLine PusatX
, PusatY
, int
PusatX +
Math .
sin 2
Math .
PI Menit
60 pjg
2.1 ,
int PusatY
+-
1 Math
. cos
2 Math
. PI
Menit 60
pjg 2.1
;
float Jam
= Waktu
Calendar .
HOUR +
float Menit
60 ;
G .
drawLine PusatX
, PusatY
, int
PusatX +
Math .
sin 2
Math .
PI Jam
1 2
pjg 2.3
, int
PusatY +-
1 Math
. cos
2 Math
. PI
Jam 12
pjg 2.3
; G
. fillOval
PusatX -
5 ,
PusatY -
5 ,
10 ,
10 ;
} new
javax .
swing .
Timer 1000
, new
ActionListener {
mengatur kecepatan detik 1 detik 1000 ms
publicvoid actionPerformed
ActionEvent ev {
repaint ;
PusatX =
getWidth 2
;
PusatY =
getHeight 2
;
xorR =
Rdm .
nextInt 255
;
xorG =
Rdm .
nextInt 255
;
xorB =
Rdm .
nextInt 255
; }
}. start
; }
publicstaticvoid main String
[] a
{ new
Tugas3_JamAnalog .
setVisible true
; }
publicvoid paint
Graphics G {
G .
setColor Color
. black
; warna jam
int pjg
; if
getWidth getHeight
pjg =
getWidth -
100 ;
else pjg
= getHeight
- 100
; G
. drawOval
PusatX -
pjg 2
, PusatY
- pjg
2 ,
pjg ,
pjg ;
for int
I= 1
;I= 12
;I++{ G
. fillOval
int PusatX
+ Math
. sin
30 Math
. PI
I 180
pjg 2
, int
PusatY +
Math .
cos 30
Math .
PI I
180 -
1 pjg
2 ,
5 ,
5 ;
G .
drawString +
I ,
int PusatX
+ Math
. sin
30 Math
. PI
I 180
pjg 2
.2 ,
int PusatY
+ Math
. cos
30 Math
. PI
I 180
- 1
pjg 2.2
; }
float Detik
= Waktu
Calendar .
SECOND +
float Waktu
Calendar .
MILLISECOND 1000
; G
. drawLine
PusatX ,
PusatY ,
int PusatX
+ Math
. sin
2 Math
. PI
Detik 60
pjg 2
, int
PusatY +-
1 Math
. cos
2 Math
. PI
Detik 60
pjg 2
;
float Menit
= Waktu
Calendar .
MINUTE +
float Detik
60 ;
G .
drawLine PusatX
, PusatY
, int
PusatX +
Math .
sin 2
Math .
PI Menit
60 pjg
2.1 ,
int PusatY
+-
1 Math
. cos
2 Math
. PI
Menit 60
pjg 2.1
;
float Jam
= Waktu
Calendar .
HOUR +
float Menit
60 ;
G .
drawLine PusatX
, PusatY
, int
PusatX +
Math .
sin 2
Math .
PI Jam
1 2
pjg 2.3
, int
PusatY +-
1 Math
. cos
2 Math
. PI
Jam 12
pjg 2.3
; G
. fillOval
PusatX -
5 ,
PusatY -
5 ,
10 ,
10 ;
} new
javax .
swing .
Timer 1000
, new
ActionListener {
mengatur kecepatan detik 1 detik 1000 ms
publicvoid actionPerformed
ActionEvent ev {
repaint ;
PusatX =
getWidth 2
;
PusatY =
getHeight 2
;
xorR =
Rdm .
nextInt 255
;
xorG =
Rdm .
nextInt 255
;
xorB =
Rdm .
nextInt 255
; }
}. start
; }
publicstaticvoid main String
[] a
{ new
Tugas3_JamAnalog .
setVisible true
; }
publicvoid paint
Graphics G {
G .
setColor Color
. black
; warna jam
int pjg
; if
getWidth getHeight
pjg =
getWidth -
100 ;
else pjg
= getHeight
- 100
; G
. drawOval
PusatX -
pjg 2
, PusatY
- pjg
2 ,
pjg ,
pjg ;
for int
I= 1
;I= 12
;I++{ G
. fillOval
int PusatX
+ Math
. sin
30 Math
. PI
I 180
pjg 2
, int
PusatY +
Math .
cos 30
Math .
PI I
180 -
1 pjg
2 ,
5 ,
5 ;
G .
drawString +
I ,
int PusatX
+ Math
. sin
30 Math
. PI
I 180
pjg 2
.2 ,
int PusatY
+ Math
. cos
30 Math
. PI
I 180
- 1
pjg 2.2
; }
float Detik
= Waktu
Calendar .
SECOND +
float Waktu
Calendar .
MILLISECOND 1000
; G
. drawLine
PusatX ,
PusatY ,
int PusatX
+ Math
. sin
2 Math
. PI
Detik 60
pjg 2
, int
PusatY +-
1 Math
. cos
2 Math
. PI
Detik 60
pjg 2
;
float Menit
= Waktu
Calendar .
MINUTE +
float Detik
60 ;
G .
drawLine PusatX
, PusatY
, int
PusatX +
Math .
sin 2
Math .
PI Menit
60 pjg
2.1 ,
int PusatY
+-
1 Math
. cos
2 Math
. PI
Menit 60
pjg 2.1
;
float Jam
= Waktu
Calendar .
HOUR +
float Menit
60 ;
G .
drawLine PusatX
, PusatY
, int
PusatX +
Math .
sin 2
Math .
PI Jam
1 2
pjg 2.3
, int
PusatY +-
1 Math
. cos
2 Math
. PI
Jam 12
pjg 2.3
; G
. fillOval
PusatX -
5 ,
PusatY -
5 ,
10 ,
10 ;
}