See what I did:
This is the image I used for testing:

after splitting the image:

and here is the source:
import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class Test { private JFrame frame; private JLabel[] labels; private static String imagePath = "c:/test.jpg"; private final int rows = 3;
The only drawback: I did not check if the image is larger than the screen, which can cause problems that will be resolved by simply resizing the image using getScaledInstance(int x,int y, int width, in height) on the image and dividing it into pieces.
EDIT / UPDATE:
Sorry, I missed the part if the question is in the figure, look at the draw(Shape s) Graphics2D / Graphics method.
I read this:
Any Shape object can be used as a clipping path that limits the portion of the drawing area to be displayed. Clipping path is part of the Graphics2D context; to set the attribute of the clip, you call Graphics2D.setClip and submit in the form that defines the clipping path you want to use.
see here to crop the image u] in the form: Cropping a drawing area
Literature:
source share