If Mona Lisa was a puzzle...

...this would define her:class PuzzleScene extends ObjectScene { public PuzzleScene() { LayerWidget layerWidget = new LayerWidget(this); ImageIcon mona = ImageUtilities.loadImageIcon("org/mona/puzzle/board/puzzle.jpg", true); Image source = mona.getImage(); int width = mona.getIconWidth(); int height = mona.getIconHeight(); Random generator = new Random(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 3; j++) { Image image = Toolkit.getDefaultToolkit().createImage( new FilteredImageSource(source.getSource(), new CropImageFilter(j * width / 3, i * height / 4, (width / 3) + 1, height / 4))); layerWidget.addChild(new PuzzleWidget( this, image, generator.nextInt(600), generator.nextInt(300))); } } addChild(layerWidget); } class PuzzleWidget extends IconNodeWidget { public PuzzleWidget(Scene scene, Image image, int x, int y) { super(scene); setImage(image); //In the end, we need our own move action, which will //check whether the piece, when dropped, is in the right place, //for the moment, just use the default move action: getActions().addAction(ActionFactory.createMoveAct ion()); setPreferredLocation(new Point(x, y)); } } }
With thanks to this and this article.


Read More about [Mona Lisa Puzzle...