Gambar.java



//Gambar.java
import java.awt.*;
import javax.swing.*;
public class Gambar extends JFrame {
public Gambar()
{
super("Drawing lines, rectangles and ovals ");
setSize( 400, 400 );
setVisible( true );
}
public void paint( Graphics g )
{
super.paint( g );
g.setColor( Color.RED );

g.drawLine( 50, 50, 100, 50 );
g.drawLine( 100, 50, 100, 100 );
g.drawLine( 50, 50, 100, 100 );

g.fillRect( 50, 100, 100, 50 );

g.drawOval( 50, 150, 50, 50 );
g.fillOval( 50, 200, 100, 50 );

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