Taki Takining Suwaka Guna Widya

Cara Menampilkan Gambar Dari Komputer Dengan Java

Copy paste souce code di bawah ini . .

import java.awt.*;
public class Gambar extends Frame {
public static void main(String[] args) {
Gambar apl=new Gambar();

}
public Gambar() {
super(“GAMBAR1″);
setSize(300,400);

canvas kanvas = new canvas();
add(kanvas);
show();

}
}

class canvas extends Canvas {
public void paint (Graphics g){
Toolkit tkit;
tkit=getToolkit();
Image img=tkit.getImage(“Image1.jpg”);
g.drawImage(img,0,0,this);
}
}

Semoga Bisa Membantu kalian Semua  .

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.