Friday, October 21, 2011

import javax.swing.*;
import java.awt.*;

class grap1 extends Canvas
{
    public void paint (Graphics dodol)
   
       //(x,y,width,height)
       dodol.drawRect(1,5,50,20);
       dodol.drawLine(35,50,100,70);
   
        //(x,y,width,height,arcwidth,archeight
        dodol.drawRoundRect(1,50,30,40,5,100);
        dodol.setColor(color.YELLOW); //set warna
        dodol.drawOval(110,50,40,30);
        dodol.setFont(new Font("Tahoma",Font.ITALIC,20));
        dodol.drawString("9511500134",80,15);
        dodol.setColor(Color.BLUE); //set warna
        dodol.fill3DRect(1,110,30,20);
        dodol.fillOval(50,110,30,20);
    }
}

//Class frame
class grap11 extends JFrame
{
    private Container konten = new Container();
    private grap11 goni = new grap1();
   
    grap11()
    {
        super("Universitas Budi Luhur");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLocation(10,100);this.setSize(250,200);
        konten.add(goni);
        show();
    }
}

0 komentar: