Bunga.java



//Bunga.java
import java.awt.*;
import javax.swing.*;
public class Bunga extends JFrame {
public Bunga()
{
super("Gambar Bunga ");
setSize( 400, 400 );
setVisible( true );
}
public void paint( Graphics g )
{
super.paint( g );

// membersihkan layar dengan mengisi semua layar dengan warna hitam
g.setColor( Color.BLACK );
g.fillRect(0, 0, getWidth(), getHeight());

//sudut ranting kanan atas
g.setColor( Color.GREEN );
g.drawArc(80, 280, 50, 200,0, 180);

//sudur ranting kanan bawah
g.setColor( Color.GREEN );
g.drawArc(80, 110, 50, 550,0, 180);

//kotak
g.setColor( Color.BLACK );
g.fillRect(100,130,40,255);

//sudut bunga kuncup
g.setColor( Color.GREEN );
g.fillArc(112, 130, 5, 23,0,360);

//sudut bunga kuncup //yellow
g.setColor( Color.YELLOW );
g.fillArc(112, 140, 5, 13,0,360);

//sudut ranting kiri atas
g.setColor( Color.GREEN );
g.drawArc(-30, 150, 110, 450,0, 90);

//sudut ranting kiri tengah
g.setColor( Color.GREEN );
g.drawArc(-50, 200, 130, 350,0, 90);

//sudut ranting kiri bawah
g.setColor( Color.GREEN );
g.drawArc(30, 300, 50, 150, 0, 90);

//sudut bulan
g.setColor( Color.WHITE );
g.fillArc(150,120 , 60, 60,0,360);

//sudut awan kecil
g.setColor( new Color(200, 200,200));
g.fillArc(165,160, 20, 20,0,180);

//sudut awan besar
g.setColor(new Color(200, 200,200));
g.fillArc(180,145, 50, 50,0,180);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(130,110,4, 4,0,350);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(120,115,4, 4,0,350);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(125,130,5, 5,0,350);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(75,115,5, 5,0,350);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(40,125,4, 4,0,350);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(35,135,4, 4,0,350);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(220,130,5, 5,0,350);

//sudut bintang
g.setColor( Color.WHITE );
g.fillArc(210,110,4, 4,0,350);
}
public static void main( String arg[] )
{
Bunga application = new Bunga ();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s