Here you can find the source of cascadeHorizontal(final BufferedImage... images)
public static BufferedImage cascadeHorizontal(final BufferedImage... images) throws Exception
//package com.java2s; //License from project: Open Source License import java.awt.Graphics2D; import java.awt.image.BufferedImage; public class Main { public static BufferedImage cascadeHorizontal(final BufferedImage... images) throws Exception { if (images.length == 0) { return null; }//w w w.j ava 2s . c om if (images.length == 1) { return images[0]; } int height = images[0].getHeight(); int width = 0; for (BufferedImage image : images) { if (image == null) { continue; } if (image.getHeight() != height) { throw new Exception("Images must be equal height."); } width += image.getWidth(); } BufferedImage cascade = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = cascade.createGraphics(); int index = 0; for (BufferedImage image : images) { if (image == null) { continue; } graphics.drawImage(image, index, 0, null); index += image.getWidth(); } graphics.dispose(); return cascade; } }