- // Copy scaled, smoothed image onto the screen
- inG.drawImage(_thumbnail, 0, 0, _thumbnail.getWidth(), _thumbnail.getHeight(), null);
+ // Copy scaled, smoothed (and rotated) image into scaled
+ int usableWidth = getParent().getWidth()-10;
+ Image scaled = ImageUtils.rotateImage(_thumbnail, usableWidth, usableWidth, _photo.getRotationDegrees());
+ int scaleWidth = scaled.getWidth(null);
+ int scaleHeight = scaled.getHeight(null);
+ // Draw scaled / rotated image to component
+ int horizOffset = (getWidth() - scaleWidth) / 2;
+ int vertOffset = (getHeight() - scaleHeight) / 2;
+ inG.drawImage(scaled, horizOffset, vertOffset, scaleWidth, scaleHeight, null);
+ if (getHeight() < getWidth())
+ {
+ setPreferredSize(new Dimension(usableWidth, usableWidth));
+ invalidate();
+ }