import javax.swing.*;
import java.awt.*;
class MyP extends JPanel{
Image img;
public MyP(){
img=Toolkit.getDefaultToolkit().getImage("11.gif");
}
public void paintComponent(Graphics g){
super.paintComponent(g);
g.drawImage(img,1,1,this);
}
}
public class MyImage extends JFrame{
MyP p;
public MyImage(){
p=new MyP();
Container con=getContentPane();
con.add(p);
setTitle("Image");
setSize(130,149);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[]){
MyImage m=new MyImage();
m.show();
}
我的你试试
[此贴子已经被作者于2006-7-7 20:44:17编辑过]