그림 파일불러오기

개발/코딩 2013. 10. 10. 16:31

import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;


public class MyFrame extends Frame{

 private Image img;
 public MyFrame(){
  Toolkit tk=Toolkit.getDefaultToolkit();
  img=tk.getImage("res/222.jpg");  //이미지 선택
 }
 public void paint(Graphics g) {
  
  super.paint(g);
  try{
   int offy=0;
  g.drawImage(img,0,0,210,60,0,0,200,50,this);//시작좌표(너비),시작좌표(높이),끝,끝,가져올이미지의<<
  Thread.sleep(500);  //0.5초 간격으로 멈추기
  
  offy +=10;
  g.drawImage(img,0,0,210,60,0,0+offy,500,200+offy,this  Thread.sleep(500);
  offy +=10;
  
  g.drawImage(img,0,0,210,60,0,0+offy,500,200+offy,this  Thread.sleep(500);
  offy +=10;
  
  g.drawImage(img,0,0,210,60,0,0+offy,500,200+offy,this  Thread.sleep(500);
  offy +=10;
  g.drawImage(img,0,0,210,60,0,0+offy,500,200+offy,this  Thread.sleep(500);
  offy +=10;
  g.drawImage(img,0,0,210,60,0,0+offy,500,200+offy,this  Thread.sleep(500);
  offy +=10;
 
  
  g.drawImage(img,0,0,210,60,0,0+offy,500,200+offy,this 
 
  }catch(InterruptedException e){
  e.printStackTrace();
  
  }
 } 
 
}

'개발 > 코딩' 카테고리의 다른 글

비행기  (0) 2013.10.11
삽입 정렬  (0) 2013.10.11
캡슐 이해 (오목)  (0) 2013.10.07
get,set이용해서 성적입력 Ver2  (0) 2013.10.02
상속(예제)  (0) 2013.10.01