Jajarangenjang.java


//Jajarangenjang.java
import java.awt.*;
import javax.swing.*;
public class Jajarangenjang extends JFrame {
public Jajarangenjang()
{
super(“Gambar Jajaran Genjang “);
setSize( 500, 500 );
setVisible( true );
}
public void paint( Graphics g )
{
super.paint( g );

//belah ketupat
g.setColor( Color.RED );
int xValue2[] = { 150,450,350, 50,150 };
int yValue2[] = { 100,100,400,400,100 };
Polygon polygon2 = new Polygon( xValue2, yValue2, 5);
g.fillPolygon( polygon2 );

g.setColor( Color.BLUE );
g.drawPolygon( polygon2 );

}
public static void main( String arg[] )
{
Jajarangenjang application = new Jajarangenjang ();
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