+ super(inFile, null);
+ }
+
+ /**
+ * Calculate the size of the image (slow)
+ */
+ private void calculateSize()
+ {
+ ImageIcon icon = new ImageIcon(_file.getAbsolutePath());
+ int width = icon.getIconWidth();
+ int height = icon.getIconHeight();
+ if (width > 0 && height > 0)
+ {
+ _size = new Dimension(width, height);
+ }
+ }
+
+ /**
+ * @return size of image as Dimension object
+ */
+ public Dimension getSize()
+ {
+ if (_size == null) {
+ calculateSize();
+ }
+ return _size;
+ }
+
+ /**
+ * @return width of the image, if known
+ */
+ public int getWidth()
+ {
+ if (_size == null)
+ {
+ calculateSize();
+ if (_size == null) {return -1;}
+ }
+ return _size.width;