• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serialization??

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Any help or advice would be appreciated.
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Prionsios Mac Giollacom�in
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Should I send the ObjectOutputStream to a certain file?
 
Prionsios Mac Giollacom�in
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic