hey all currently i'm working on a program that cuts an image into pieces and randomly displays them in another frame. the problem that i'm running into is that when it displays the picture again it's not displaying it random at all. here is a copy of the code
CODE
class MyPanel extends JPanel
{
Random gen = new Random();
int ran = gen.nextInt(cut_number);
public MyPanel(BufferedImage image[], int col, int row)
{
System.out.println(ran);
JPanel panel = new JPanel();
GridLayout layout = new GridLayout(row , col);
panel.setLayout(layout);
panel.setSize(split.getWidth(), split.getHeight());
}
public void paintComponent(Graphics g){
for (int x = 0; x < splitArr.length; x++)
for(int y = 0; y < splitArr.length; y++)
g.drawImage(splitArr[ran], x,y,(ImageObserver) this);
}
}
any ideas would be appreciated