Membuat lingkaran seperti gambar dibawah ini.......
dengan menggunakan Java Netbeans....
berikut kodingnya.....
lumayan susah bro...
puying...puying lihat codingnya...
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gui_java;
/**
*
* @author Dominggo
*/
import java.awt.*;
public class Gui_java extends Panel{
Gui_java(){
setBackground(new Color(227, 227, 227));// warna background
}
public void paint(Graphics A){
A.setColor(Color.black);
A.drawArc(229,29, 152, 151, 0, 360);//draw lingkaran kepala
A.setColor(new Color(237, 202, 39));
A.fillArc(230,30, 150, 150, 0, 360);//warnai lingkaran kepala
A.setColor(Color.WHITE);
A.fillArc(265,70, 20, 40, 0, 360);//mata putih kiri
A.setColor(Color.WHITE);
A.fillArc(325,70, 20, 40, 0, 360);//mata putih kanan
A.setColor(Color.BLACK);
A.fillArc(325,75, 20, 30, 0, 360);//mata hitam kanan
A.setColor(Color.BLACK);
A.fillArc(265,75, 20, 30, 0, 360);//mata hitam kiri
A.setColor(Color.red);
A.fillArc(275,100, 65, 60, 0, -180);//fill mulut
}
public static void main(String[] args) {
// TODO code application logic here
Frame f1 = new Frame();
Gui_java H = new Gui_java();
f1.add(H);
f1.setSize(600, 300);
f1.setVisible(true);
}
}
Tidak ada komentar:
Posting Komentar