jigsaw tutorial

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2009
Posts: 27
Reputation: JohnPhilipps is an unknown quantity at this point 
Solved Threads: 0
JohnPhilipps JohnPhilipps is offline Offline
Light Poster

jigsaw tutorial

 
0
  #1
Jul 11th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,836
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 503
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: jigsaw tutorial

 
0
  #2
Jul 11th, 2009
Originally Posted by JohnPhilipps View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 997
Reputation: JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice 
Solved Threads: 147
JamesCherrill JamesCherrill is offline Offline
Posting Shark

Re: jigsaw tutorial

 
0
  #3
Jul 12th, 2009
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 27
Reputation: JohnPhilipps is an unknown quantity at this point 
Solved Threads: 0
JohnPhilipps JohnPhilipps is offline Offline
Light Poster

Re: jigsaw tutorial

 
0
  #4
Jul 12th, 2009
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/in...5247&hl=jigsaw
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC