SegiEmpat.java


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

//belah ketupat
g.setColor( Color.RED );
g.drawRect(50,50,200,100);
g.fillRect(275,50,200,100);

g.setColor( Color.BLUE );
g.drawRoundRect(50,200,100,200,25,25);
g.fillRoundRect(200,200,100,200,25,25);
g.fillRoundRect(350,200,100,200,50,100);

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