@@ -0,0 +1,1972 @@
+/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage cidisplay;%0A%0Aimport java.awt.ComponentOrientation;%0Aimport java.awt.GridLayout;%0Aimport java.awt.image.BufferedImage;%0Aimport javax.swing.JPanel;%0A%0A/**%0A *%0A * @author Radsaggi%0A */%0Apublic final class CutImageGrid extends JPanel %7B%0A%0A    private ImageToggleButton buttons%5B%5D%5B%5D;%0A    private int eachWidth, eachHeight;%0A    private int rows, columns;%0A    private BufferedImage image;%0A%0A    public CutImageGrid(int rows, int columns) %7B%0A        super();%0A%0A        setLayout(new GridLayout(rows, columns));%0A        setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);%0A%0A        this.rows = rows;%0A        this.columns = columns;%0A%0A        buttons = new ImageToggleButton%5Brows%5D%5Bcolumns%5D;%0A        for (int i = 0; i %3C rows; i++) %7B%0A            for (int j = 0; j %3C columns; j++) %7B%0A                buttons%5Bi%5D%5Bj%5D = new ImageToggleButton(new String(%0A                        new char%5B%5D%7B(char) ('A' + i), ' ', (char) ('A' + j)%7D));%0A                this.add(buttons%5Bi%5D%5Bj%5D);%0A            %7D%0A        %7D%0A%0A        eachWidth = eachHeight = 0;%0A    %7D%0A%0A    public CutImageGrid(BufferedImage image, int rows, int columns) %7B%0A        this(rows, columns);%0A        setImage(image);%0A    %7D%0A%0A    public void setImage(BufferedImage image) %7B%0A        this.image = image;%0A%0A        eachHeight = image.getHeight() / rows;%0A        eachWidth = image.getWidth() / columns;%0A%0A%0A        for (int i = 0; i %3C rows; i++) %7B%0A            for (int j = 0; j %3C columns; j++) %7B%0A                buttons%5Bi%5D%5Bj%5D.setImage(image.getSubimage(%0A                        j * eachWidth, i * eachHeight, eachWidth, eachHeight));%0A            %7D%0A        %7D%0A    %7D%0A%0A    public boolean isImageSet() %7B%0A        return image != null;%0A    %7D%0A%0A    public void setAllButtonState(boolean z) %7B%0A        for (int i = 0; i %3C rows; i++) %7B%0A            for (int j = 0; j %3C columns; j++) %7B%0A                buttons%5Bi%5D%5Bj%5D.setSelected(z);%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Create CutImageGrid.java