Im new to java programming. I have set up a sudoku GUI. I have 81 JComboBoxes in a 9x9 array. The main GUI is a JFrame with 9 JPanels added to it. Each panel holds 9 instances of JComboBox, which are populated with the numbers 1-to-9.
Basically, I want to be able to input a sudoku puzzle and then save it. Then if I come back later I should be able to open it up from where it was saved.
This is probably simple, but it is confusing me. By using serialization can I read what Items have been selected and save it so that it will open up exactly the same later? Each ComboBox knows its coordinates.
I would also like to remove the itemlisteners from the comboboxes that have been inputed, so that these given sudoku values cannot be tampered with.
Yes.You can do it with the help of Serialization.Make one data object of all these values.(dataobject I mean setter,getter) and save it in database when user exists.You can save this object in BLOB column of database. When user comes next time,read the BLOB data ,type cast into your data object and set it in the GUI.
Let me know if you face any problem.
"There are no mistakes, only lessons"
Prionsios Mac Giollacom�in
Joined: Jan 16, 2006
Im not really sure what you mean.
Ive a toString() method which prints out whats selected in each instance of JComboBox( using the itemStateChanged() method of JComboBox). How would I read this into a BLOB and remove the itemListener or itemStateChanged event from the JComboBox object?
I suppose the first step is to set up a JButton "Set", which when pressed should, input the information into a BLOB and simultaneously deactivate the itemListners on the respective JComboBoxes........but not sure how!