显示图像选定的部分图片

 public static Image initImgNumbers(Image img,int x,int y,int w,int h){
        Image imgTotal = Image.createImage(img);
      
        Graphics g;
        Image image=Image.createImage(w,h);
        g=image.getGraphics();
        g.drawImage(imgTotal, -x, -y, 0);
        return image;
 }