untuk source code nya :
package robby;
import java.awt.*;
import java.awt.event.ActionEvent;
/**
*
* @author Putri
*/
public class Robby extends Panel{
Robby(){
setBackground(new Color(227, 227, 227));// warna background
}
public void paint(Graphics A){
A.setColor(new Color(50,55,70));//warna font Nama
A.setFont(new Font("Snap ITC", Font.BOLD,20));// jenis font
A.drawString("Nama : robby meirio",20, 255);// koordinat/letak font
A.setColor(new Color(34, 11, 55));//warna font Nama dan kelas
A.setFont(new Font("Showcard Gothic", Font.BOLD,20));// jenis font
A.drawString("Nim : 11110100",350, 255);// koordinat/letak font
A.setColor(new Color(34, 11, 55));//warna font Nama dan kelas
A.setFont(new Font("Showcard Gothic", Font.BOLD,20));// jenis font
A.drawString("Kelas : A",20, 155);// koordinat/letak font
// A.drawOval(30, 100, 40, 30);
// A.drawLine(10, 100, 100,100);
A.setColor(Color.red);
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.blue);
A.fillArc(265,70, 20, 40, 0, 360);//mata putih kiri
A.setColor(Color.blue);
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
Image gambar = Toolkit.getDefaultToolkit().getImage("Domo-kun.png");
A.drawImage(gambar, 20, 30, 180, 165, this);
Image gambarr = Toolkit.getDefaultToolkit().getImage("heart005.png");
A.drawImage(gambarr, 20, 30, 30, 30, this);
//A.setColor(Color.GREEN);
//A.fillOval(280, 50, 100, 90);
// A.drawRoundRect(30, 100, 200, 30, 20, 20);
}
public static void main(String[] args) {
// TODO code application logic here
Frame f1 = new Frame();
Robby H = new Robby();
f1.add(H);
f1.setSize(600, 300);
f1.setVisible(true);
}
public void actionPerformed(ActionEvent ev) {
String command = ev.getActionCommand();
if ("Exit".equals(command)) {
System.exit(0);
}
}
}
Tidak ada komentar:
Posting Komentar