private static double getIconRatio(BufferedImage src, BufferedImage icon)
	{
		double ratio = 1;
		if (src.getWidth() > icon.getWidth()) {
                ratio = (double) (icon.getWidth()) / src.getWidth();
            }
		else {
                ratio = (int) (icon.getWidth() / src.getWidth());
            }
		if (src.getHeight() > icon.getHeight())
		{
			double r2 = (double) (icon.getHeight()) / src.getHeight();
			if (r2 < ratio) {
                        ratio = r2;
                    }
		}
		else
		{
			double r2 = (int) (icon.getHeight() / src.getHeight());
			if (r2 < ratio) {
                        ratio = r2;
                    }
		}
		return ratio;
	}