TUGAS 2 MEMBUAT LINGKARAN PADA NETBEANS
Mengaktifkan program Netbeans
1. Pilih
new project
2. Pilih
java lalu klik pada java Application
3. Ketik
nama project ,disini saya memberi nama Project “membuat titik”
KODING
:
/*
* To change
this template, choose Tools | Templates
* and open
the template in the editor.
*/
package Titik;
import java.awt.Color;//import class library Color
import java.awt.Font;//import class library Font
import java.awt.Frame;//import class library Frame
import java.awt.Graphics;//import class library
Graphics
import java.awt.Panel;//import class library Panel
/**
*
* @author
paulla sose mau
*/
public class Titik extends Panel{
Titik(){
setBackground(new Color(255,255,255));//Background berwarna merah
}
public void paint(Graphics a){
//membuat wajah dengan warna hitam
a.setColor(Color.yellow);
a.fillOval(5,30,400,500);
//membuat Tulisan
a.setColor(Color.black);//kotak berwarna
kuning
a.fillRect(390, 460, 180, 100);
a.setFont(new Font("Arial", Font.BOLD,22));
a.setColor(Color.blue);//teks berwarna biru
a.drawString("Paulina",400,480);
a.setFont(new Font("Arial", Font.BOLD,22));
a.drawString("Artha Buana",400,510);
a.setFont(new Font("Arial", Font.BOLD,22));
a.drawString("13110241",400,540);
//membuat Bintang mata kiri
a.setColor(Color.black);
int[]
sgtX1 = {50, 100, 150};
int[]
sgtY1 = {190, 90, 190};
a.fillPolygon(sgtX1, sgtY1, 3);
a.setColor(Color.black);
int[]
sgtX2 = {40, 100, 160};
int[]
sgtY2 = {130, 190, 130};
a.fillPolygon(sgtX2,
sgtY2, 3);
a.setColor(Color.yellow);
int[]
sgtX3 = {50, 100, 150};
int[]
sgtY3 = {190, 170, 190};
a.fillPolygon(sgtX3, sgtY3, 3);
//membuat Bintang mata kanan
a.setColor(Color.black);
int[]
sgtX1_1 = {250, 300, 350};
int[]
sgtY1_1 = {190, 90, 190};
a.fillPolygon(sgtX1_1, sgtY1_1, 3);
a.setColor(Color.black);
int[]
sgtX2_1 = {240, 300, 360};
int[]
sgtY2_1 = {130, 190, 130};
a.fillPolygon(sgtX2_1, sgtY2_1, 3);
a.setColor(Color.yellow);
int[]
sgtX3_1 = {250, 300, 350};
int[]
sgtY3_1 = {190, 170, 190};
a.fillPolygon(sgtX3_1, sgtY3_1, 3);
//membuat Bintang hidung
a.setColor(Color.yellow);
int[]
sgtX1_2 = {180, 200, 220};
int[]
sgtY1_2 = {270, 200, 270};
a.fillPolygon(sgtX1_2, sgtY1_2, 3);
a.setColor(Color.yellow);
int[]
sgtX2_2 = {170, 200, 230};
int[]
sgtY2_2 = {230, 270, 230};
a.fillPolygon(sgtX2_2, sgtY2_2, 3);
a.setColor(Color.black);
int[]
sgtX3_2 = {180, 200, 220};
int[]
sgtY3_2 = {270, 260, 270};
a.fillPolygon(sgtX3_2, sgtY3_2, 3);
a.setColor(Color.black);
a.drawArc(70, 300, 260, 100, 0, -180);
//membuat Bintang senyum kiri
a.setColor(Color.yellow);
int[]
sgtX1_3 = {40, 65, 90};
int[]
sgtY1_3 = {340, 290, 340};
a.fillPolygon(sgtX1_3, sgtY1_3, 3);
a.setColor(Color.yellow);
int[]
sgtX2_3 = {40, 65, 90};
int[]
sgtY2_3 = {310, 340, 310};
a.fillPolygon(sgtX2_3, sgtY2_3, 3);
a.setColor(Color.black);
int[]
sgtX3_3 = {40, 65, 90};
int[]
sgtY3_3 = {340, 330, 340};
a.fillPolygon(sgtX3_3, sgtY3_3, 3);
//membuat Bintang senyum kanan
a.setColor(Color.yellow);
int[]
sgtX1_4 = {310, 335, 360};
int[]
sgtY1_4 = {340, 290, 340};
a.fillPolygon(sgtX1_4, sgtY1_4, 3);
a.setColor(Color.yellow);
int[]
sgtX2_4 = {310, 335, 360};
int[]
sgtY2_4 = {310, 340, 310};
a.fillPolygon(sgtX2_4, sgtY2_4, 3);
a.setColor(Color.black);
int[]
sgtX3_4 = {310, 335, 360};
int[]
sgtY3_4 = {340, 330, 340};
a.fillPolygon(sgtX3_4, sgtY3_4, 3);
}
public
static void main(String[] args) {
Frame f1=new Frame("Paulina Sose
Mau");//instansiasi dan memberi nama framenya "Hello Bintang"
Titik
h1=new Titik();//memanggil class bintang
f1.add(h1);
f1.setSize(640,640);//ukuran frame 640px X 640px
f1.setVisible(true);
}
}
TAMPILANNYA SEPERTI GAMBAR INI
Sekian dari saya ,semoga membantu…………………..GBU
!!!!!!!!!!!