Terai Atsuhiro 2023-10-12 (木) 10:54:52

private Dimension getImageDimension(Image img) {
  MediaTracker tracker = new MediaTracker((Container)this);
  tracker.addImage(img, 0); 
  try{
    tracker.waitForID(0);
  }catch(InterruptedException e) {}
  return new Dimension(img.getWidth(null), img.getHeight(null));
}