Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    You don't serialize the java program. You only need to save the current values in variables like ints and Strings.

    For your test program, remove ALL of the GUI. No frames, panels, buttons etc.
    ...
  2. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    A 300 line file is not a small program.
    You don't need any GUI to test Serialization with. Just some classes to write and read back.
    The frame doesn't show any components and doesn't handle window...
  3. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    To have a class implement an interface:

    class ClassName implements Serializable {


    Add this just before the writeObject(theObject):
    System.out.println("obj class=" + theObject.getClass()); ...
  4. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    Go read post#12

    Did you understand what the API doc said for that Exception?
  5. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    do you use writeObject()
    Yes
  6. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    Please explain "what I want".


    No you can use any file extension that you want. Chose one that won't confuse the OS. Like .dat or .ser

    Best way to answer all your questions is to write a small...
  7. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    How did you write them out? Take the class name and replace Output with Input
  8. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    If you serialize an object to a file using an output class, you use the corresponding input class to read the object back into a java program and recreate the object as it existed when it was written...
  9. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    Best way to answer all these "what if" questions is to write a small test program and see what happens.
  10. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    Yes, you can only serialize objects that are.
  11. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    Try instanceof to test a class.
  12. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    I'd suggest that you write a small test program with a few simple classes and work on writing them to a disk file using a ObjectOutputStream and then read them back with a ObjectInputStream and...
  13. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    Hard question to answer.
    The quick answer is somewhere in your code.
    The "what data" is really hard. What do you want to be able to retrieve later?


    JFileChooser is a way to have the user...
  14. Replies
    35
    Views
    7,328

    Re: Can't get it to save stuff with JFileChooser

    Your program is too large to work with.
    Can you make a small program that compiles and executes to demonstrate the problem?
Results 1 to 14 of 14