wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Puzzle Solver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Puzzle Solver" Watch "Puzzle Solver" New topic
Author

Puzzle Solver

Jane Florence
Greenhorn

Joined: Nov 28, 2012
Posts: 5
Hi all,
I am new in this forum and this is my first post.
I am doing an assignment of the number puzzle solver and my deadline is approaching. I have created the GUI and the layout only. So what I left to do is to create methods to listen the action from all those JButtons, such as shuffle, clockwise, anticlockwise, swap and push. If you know how to do one or two (or more) methods, just post please. I am seriously urgent and seeking people to contribute ideas. I just attached the picture of GUI that was created. Hope somebody can help me!

Here is the some of the criteria of how the JButton should work.
http://goo.gl/pUIIO


[Thumbnail for puzzle.JPG]

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
Welcome to the Ranch

That is not quite how we operate here. You should tell us what you have done, and whether it is working. Then we shall be happy to help you with yoru problems.
I shall move this discussion because you have managed to land in the wrong place.
There are a few words we never use: one of them is “urgent”.
Jane Florence
Greenhorn

Joined: Nov 28, 2012
Posts: 5
Sorry about that... I am so sorry to have bad impression in my first post!

Jane Florence
Greenhorn

Joined: Nov 28, 2012
Posts: 5
This is all what I have done so far.



Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
I have added code tags, which you should always use, and you can see how much better it looks.
What is the actual problem? Are your buttons not being enabled, or are they not activating their listeners. I suggest, just for a start, you implement the methods like thisThat code will show you that you are successfully calling those methods. You can then replace it with something more useful.

Use spaces. not tabs for indenting. Why have you imported FlowLayout, which you appear not to be using? FlowLayout is pretty useless, anyway.
Have you really got two }} between the genSwap and genPush methods? That is probably a mistake, and you might get all sorts of compiler errors because of that additional }
Jane Florence
Greenhorn

Joined: Nov 28, 2012
Posts: 5
Thanks for your reply and sorry for my late reply.
My problem now is that I have difficulty in how to write methods for rotating clockwise and anticlockwise.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
What is the algorithm for rotating? You need to work that out before you can implement those methods.
Jane Florence
Greenhorn

Joined: Nov 28, 2012
Posts: 5
The logic is that when we rotate clockwise, let's say 4x4 table, row 1 becomes column 4, column 4 becomes row 4, row 4 becomes column 1 and column 1 becomes row 1. And the middle 4 cells also rotate in that way. When you look at the picture, I think it will be more clear about the logic.



[Thumbnail for original.JPG]


[Thumbnail for clockwise.JPG]


[Thumbnail for anticlockwise.JPG]

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Puzzle Solver
 
Similar Threads
SoDuko puzzle
Puzzle
Puzzle
puzzle
The Last Puzzle of the Night