1,105,177 Community Members

jigsaw tutorial

Member Avatar
JohnPhilipps
Junior Poster in Training
65 posts since Jun 2009
Reputation Points: 16 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Good evening,

I have the need to learn how to make a picture jigsaw with java.
I have been looking for hours on the web for some kind of tutorial, source code example, something anything and I haven't been successfull in finding something I could work with.

Would somebody have a suggestion?
perhaps a site?
A java tutorial on how to do a picture jigsaw?

Thank you,

John

Member Avatar
VernonDozier
Posting Expert
5,632 posts since Jan 2008
Reputation Points: 2,218 [?]
Q&As Helped to Solve: 768 [?]
Skill Endorsements: 26 [?]
Featured
 
0
 

Good evening,

I have the need to learn how to make a picture jigsaw with java.
I have been looking for hours on the web for some kind of tutorial, source code example, something anything and I haven't been successfull in finding something I could work with.

Would somebody have a suggestion?
perhaps a site?
A java tutorial on how to do a picture jigsaw?

Thank you,

John

Like a jigsaw puzzle where you have a picture and then split it into smaller pictures and move the pieces around and put them together? I've never done one, never seen a tutorial for one, but I have though a lot about the subject and have been planning to write one for fun, though I have not yet.

My approach would be to split a large rectangle into smaller shapes from the Shape class. Easiest would be just smaller rectangles, but you can get much more elaborate. You have the contains and intersects methods from the Shape class. Use those methods to see whether a particular coordinate is contained inside the Shape. Have a MouseListener and drag the shapes around using mousePressed and mouseDragged. If two adjacent Shapes are next to each other in the overall picture and are "close enough" to each other when mouseReleased is called, fuse them into one Shape. When there's only one Shape left, the puzzle is solved.

The main functions are the functions that breaks an image into Shapes, breaks Shapes into smaller Shapes, and fuses Shapes together. How to do this depends on your Java experience. That's the approach I plan on taking when I get around to writing it, at least.

Member Avatar
JamesCherrill
... trying to help
10,362 posts since Apr 2008
Reputation Points: 2,081 [?]
Q&As Helped to Solve: 1,749 [?]
Skill Endorsements: 47 [?]
Moderator
Featured
 
0
 
Member Avatar
JohnPhilipps
Junior Poster in Training
65 posts since Jun 2009
Reputation Points: 16 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for reminding me of the javaFX tutorial.
I did stumble also upon it but I would have liked to stay within the regular java code.
I did find one source code example but it's not a tutorial, so I guess it will be a lot of figuring out on my own.
Just in case for reference the address is:
http://www.dreamincode.net/forums/index.php?showtopic=55247&hl=jigsaw

Question Answered as of 4 Years Ago by VernonDozier and JamesCherrill
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article