Komputer Grafik (Java)
Membuat Gambar,
.
Cara tidak praktis :
Ini kodenya :
.
Cara tidak praktis :
Ini kodenya :
public void paint(Graphics k){
super.paint(k);
k.drawLine(10, 50, 370, 50); //horizontal atas
k.drawLine(10, 110, 370, 110); //horizontal bawah 1
k.drawLine(10, 170, 370, 170); //horizontal bawah 2
k.drawLine(10, 230, 370, 230); //horizontal bawah 1
k.drawLine(10, 290, 370, 290); //horizontal bawah
k.drawLine(10, 50, 10, 290); //vertical kiri 1
k.drawLine(70, 50, 70, 290); //vertical kiri 2
k.drawLine(130, 50, 130, 290); //vertical kiri 3
k.drawLine(190, 50, 190, 290); //vertical kiri 4
k.drawLine(250, 50, 250, 290); //vertical kiri 5
k.drawLine(310, 50, 310, 290); //vertical kiri 6
k.drawLine(370, 50, 370, 290); //vertical kiri 7
k.drawLine(430, 50, 430, 290); //vertical kiri 8
k.drawLine(10, 80, 40, 50); //diagonal 1
k.drawLine(10, 140, 100, 50); //diagonal 2
k.drawLine(10, 200, 160, 50); //diagonal 3
k.drawLine(10, 260, 220, 50); //diagonal 4
k.drawLine(40, 290, 280, 50); //diagonal 5
k.drawLine(100, 290, 340, 50); //diagonal 6
k.drawLine(160, 290, 370, 80); //diagonal 7
k.drawLine(220, 290, 370, 140); //diagonal 8
k.drawLine(280, 290, 370, 200); //diagonal 9
k.drawLine(340, 290, 370, 260); //diagonal 10
k.drawLine(10, 260, 40, 290); //diagonal 5 //bawah kiri
k.drawLine(10, 200, 100, 290);
k.drawLine(10, 140, 160, 290);
k.drawLine(10, 80, 220, 290);
k.drawLine( 40, 50, 280, 290);
k.drawLine( 100, 50, 340, 290);
k.drawLine(370, 80, 340, 50); //diagonal
k.drawLine(370, 140, 280, 50);
k.drawLine(370, 200, 220, 50);
k.drawLine(370, 260, 160, 50);
}
super.paint(k);
k.drawLine(10, 50, 370, 50); //horizontal atas
k.drawLine(10, 110, 370, 110); //horizontal bawah 1
k.drawLine(10, 170, 370, 170); //horizontal bawah 2
k.drawLine(10, 230, 370, 230); //horizontal bawah 1
k.drawLine(10, 290, 370, 290); //horizontal bawah
k.drawLine(10, 50, 10, 290); //vertical kiri 1
k.drawLine(70, 50, 70, 290); //vertical kiri 2
k.drawLine(130, 50, 130, 290); //vertical kiri 3
k.drawLine(190, 50, 190, 290); //vertical kiri 4
k.drawLine(250, 50, 250, 290); //vertical kiri 5
k.drawLine(310, 50, 310, 290); //vertical kiri 6
k.drawLine(370, 50, 370, 290); //vertical kiri 7
k.drawLine(430, 50, 430, 290); //vertical kiri 8
k.drawLine(10, 80, 40, 50); //diagonal 1
k.drawLine(10, 140, 100, 50); //diagonal 2
k.drawLine(10, 200, 160, 50); //diagonal 3
k.drawLine(10, 260, 220, 50); //diagonal 4
k.drawLine(40, 290, 280, 50); //diagonal 5
k.drawLine(100, 290, 340, 50); //diagonal 6
k.drawLine(160, 290, 370, 80); //diagonal 7
k.drawLine(220, 290, 370, 140); //diagonal 8
k.drawLine(280, 290, 370, 200); //diagonal 9
k.drawLine(340, 290, 370, 260); //diagonal 10
k.drawLine(10, 260, 40, 290); //diagonal 5 //bawah kiri
k.drawLine(10, 200, 100, 290);
k.drawLine(10, 140, 160, 290);
k.drawLine(10, 80, 220, 290);
k.drawLine( 40, 50, 280, 290);
k.drawLine( 100, 50, 340, 290);
k.drawLine(370, 80, 340, 50); //diagonal
k.drawLine(370, 140, 280, 50);
k.drawLine(370, 200, 220, 50);
k.drawLine(370, 260, 160, 50);
}
No comments
Saya sangat berterimakasih apabila sahabat sekalian bersedia untuk tidak meninggalkan spam dan meninggalkan komentar yang berhubungan dengan artikel di atas.