This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Persistence causing problems with JButton 2D Array 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 "Persistence causing problems with JButton 2D Array" Watch "Persistence causing problems with JButton 2D Array" New topic
Author

Persistence causing problems with JButton 2D Array

mr hello
Greenhorn

Joined: Apr 21, 2010
Posts: 1
Hi there, I'm new here and I'm hoping you can help

For a student project I am creating a sudoku game which uses a 2D array of integers called model[][] and then a solving algorithm reads from this array, computes the solution and then updates a 2D array of JButtons called view[][] which the user can enter numbers. Most of the the functions read from this array to update the "model" and then the view of JButtons is updated so the user can see.

I'm using persistance to store the model[][] 2D integer array and then a load button reads the file and writes this back to the model[][]

Whenever I click my load button my updateView method seems to update the view correctly and the user can see the loaded cells but if I do something else such as start a new game or click solve (which then reads from this array and solves) the console output seems to suggest everything is working fine but my 2D array of JButtons on screen do not.

The program behaves differently for some reason after clicking load and anything else I do does not update the view correctly

Is anyone able to help me? I can send you my code. I would really appreciate it if you could.


Here's the code for the save and load operation
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Is anyone able to help me?

many can, but few will - when the problem has been cross-posted to just about all the java forums

http://forums.sun.com/thread.jspa?threadID=5436515&tstart=0

http://www.java-forums.org/new-java/28042-persistence-causing-problems-jbutton-2d-array.html

if my time is unimportant to you, you getting a solution is equally unimportant to me.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Randolph, please BeForthrightWhenCrosspostingToOtherSites.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Persistence causing problems with JButton 2D Array
 
Similar Threads
java.io.NotSerializableException when overwrite the JTable data into .txt file
Interfaces and exceptions
java.io.StreamCorruptedException: invalid stream header:i understand its a thread issue not sure fix
saving JTree
Store a linked list into a file