Hello
I am not sure what is getting serialized. I would like to serialize a JInternalFrame.
So what do I send my SaveFrame.java. because it puts a file "null.dat" in the folder.
I sent the frame got null.dat
sent something I thought was the class of the frame (as shown here) got null.dat

I named the Frame and folder Java (shown in the output)

create JInternalFrame

public static void createNotesInnerFrame(String ln) throws IOException, FileNotFoundException, SQLException, ProfileException, LoginException, javax.security.auth.login.LoginException, model.err.LoginException, UnknownUserNameException, IncorrectPasswordException, SuccessfullTargetFoldersCreation, ClassNotFoundException, InstantiationException, IllegalAccessException {

         String M =(" --> in public static void createNotesInnerFrame("+ln+") var: ln : xxxxxxxx<-- \n");
        System.out.println(M);
       
        JPanel contentPane = new JPanel(new BorderLayout());
        SetObjects so = new SetObjects();
        SetObjects.setType("notes");
        profile = ViewUtils.getProfile();
        SetObjects.initPanelComponents();
        contentPane.add(SetObjects.obj());//sets the JTabbedPane that was created on JPanel
        String notes = "notes";
        frame = new InternalFrameNotes(ln);
        frame.add(contentPane);//puts JPanel on Frame
       frame.addInternalFrameListener((InternalFrameListener) frame);
        Class<? extends JInternalFrame> frameClass=frame.getClass();
        setFrameClass(frameClass);
         SchoolJDesktopPane.setNoteFrame(frame);
        SchoolJDesktopPane.setNoteFrameName(frame.getTitle());       
        
       
    }//end CreateNew

serialize something

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.reference;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import javax.swing.JInternalFrame;
import model.err.LoginException;
import model.err.NoTargetFoldersException;
import model.err.ProfileException;
import view.ViewUtils;

/**
 *
 * @author Steves_
 */
public class SaveFrame {

   
    public String instancePath;
   
    public File target;
    public boolean bExists;
    public boolean bCreated;
    public String folderLocation;
    public String systemDir;
    public String ext=".dat";

    public SaveFrame() {
    }

    public void firstInstance(Class frameClass, String title, String path) throws FileNotFoundException, IOException, ProfileException, LoginException {

       String M =(" --> in public void firstInstance() var: xxxxxxxxx : xxxxxxxx<-- \n");
    System.out.println(M);
        instancePath = path + File.separator + title;
        setSystemDir(instancePath);

        setLocationOfFolder(systemDir);
        try {
            if (bExists) {
                throw new NoTargetFoldersException();
            }

            bCreated = serializeFrame();
            System.out.println(C+M+AND+ bCreated+": bCreated target : \n");
        } catch (NoTargetFoldersException ex) {
            String x = ex.getMessage();
            System.out.println("error message is: " + AND + x + AND + " AT// " + C + M + AND + ": : ");
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(x);
        }

    }

    private boolean serializeFrame() {
        bCreated = true;
        folderLocation=folderLocation+ext;
        try {
            FileOutputStream fo = new FileOutputStream(folderLocation);
            ObjectOutputStream oo = new ObjectOutputStream(fo);
            oo.writeObject(target);
            oo.close();
        } catch (IOException e) {
            System.out.println("Error- " + e.toString());
        }
        if (!bExists) {
            bCreated = false;
        }
        return bCreated;
    }

    public boolean bExists() {
        bExists = false;
        File target = new File(folderLocation);
        if (target.exists()) {
            bExists = true;
        }
        return bExists;
    }

    public String getLocationOfFolder() {
        return folderLocation;
    }

    public void setLocationOfFolder(String folderLocation) {
        this.folderLocation = folderLocation;
    }

    public String getSystemDir() {
        return systemDir;
    }

    public void setSystemDir(String systemDir) {
        this.systemDir = systemDir;
    }
}

output

CLASS 
 CreateOneNoteFrameFile extends CreateSystemStartFolders: 
 --> in setOneNoteFolderSystemDir() var: xxxxxxxxx : xxxxxxxx<-- 
 : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\Java: systemDir : 

 --> in public void firstInstance() var: xxxxxxxxx : xxxxxxxx<-- 

CLASS 
 public class SaveFrame: 
 --> in public void firstInstance() var: xxxxxxxxx : xxxxxxxx<-- 
 : false: bCreated target :

Hello
I am not sure what is getting serialized. I would like to serialize a JInternalFrame.
So what do I send my SaveFrame.java. because it puts a file "null.dat" in the folder.
I sent the frame got null.dat
sent something I thought was the class of the frame (as shown here) got null.dat

Clearly, frame is a class so I send Frame to be serialized.
create JInternalFrame

public static void createNotesInnerFrame(String ln) throws IOException, FileNotFoundException, SQLException, ProfileException, LoginException, javax.security.auth.login.LoginException, model.err.LoginException, UnknownUserNameException, IncorrectPasswordException, SuccessfullTargetFoldersCreation, ClassNotFoundException, InstantiationException, IllegalAccessException {

         String M =(" --> in public static void createNotesInnerFrame("+ln+") var: ln : xxxxxxxx<-- \n");
        System.out.println(M);
       
        JPanel contentPane = new JPanel(new BorderLayout());
        SetObjects so = new SetObjects();
        SetObjects.setType("notes");
        profile = ViewUtils.getProfile();
        SetObjects.initPanelComponents();
        contentPane.add(SetObjects.obj());//sets the JTabbedPane that was created on JPanel
        String notes = "notes";
        frame = new InternalFrameNotes(ln);
        frame.add(contentPane);//puts JPanel on Frame
        frame.addInternalFrameListener((InternalFrameListener) frame);
         SchoolJDesktopPane.setNoteFrame(frame);
        SchoolJDesktopPane.setNoteFrameName(frame.getTitle());       
        
       
    }//end CreateNewGuide;

serialize something

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.reference;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import javax.swing.JInternalFrame;
import model.err.LoginException;
import model.err.NoTargetFoldersException;
import model.err.ProfileException;
import view.ViewUtils;

/**
 *
 * @author Steves_
 */
public class SaveFrame {

   
    public String instancePath;
   
    public File target;
    public boolean bExists;
    public boolean bCreated;
    public String folderLocation;
    public String systemDir;
    public String ext=".dat";

    public SaveFrame() {
    }

    public void firstInstance(JInternalFrame frameClass, String title, String path)throws FileNotFoundException, IOException, ProfileException, LoginException {

       String M =(" --> in public void firstInstance() var: xxxxxxxxx : xxxxxxxx<-- \n");
    System.out.println(M);
        instancePath = path + File.separator + title;
        setSystemDir(instancePath);

        setFlolderLocation(systemDir);
        try {
            if (bExists) {
                throw new NoTargetFoldersException();
            }

            bCreated = serializeFrame();
            System.out.println(C+M+AND+ bCreated+": bCreated target : \n");
        } catch (NoTargetFoldersException ex) {
            String x = ex.getMessage();
            System.out.println("error message is: " + AND + x + AND + " AT// " + C + M + AND + ": : ");
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(x);
        }

    }

    private boolean serializeFrame() {
        bCreated = true;
       File target= new File(folderLocation+ext);
        try {
            FileOutputStream fo = new FileOutputStream(target);
            ObjectOutputStream oo = new ObjectOutputStream(fo);
            oo.writeObject(target);
            oo.close();
        } catch (IOException e) {
            System.out.println("Error- " + e.toString());
        }
        if (!bExists) {
            bCreated = false;
        }
        return bCreated;
    }

    public boolean bExists() {
        bExists = false;
        File target = new File(folderLocation);
        if (target.exists()) {
            bExists = true;
        }
        return bExists;
    }

    public String getFlolderLocation() {
        return folderLocation;
    }

    public void setFlolderLocation(String folderLocation) {
        this.folderLocation = folderLocation;
    }

    public String getSystemDir() {
        return systemDir;
    }

    public void setSystemDir(String systemDir) {
        this.systemDir = systemDir;
    }
}

output

CLASS 
 CreateOneNoteFrameFile extends CreateSystemStartFolders: 
 --> in setOneNoteFolderSystemDir() var: xxxxxxxxx : xxxxxxxx<-- 
 : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\Java: systemDir : 

 --> in public void firstInstance() var: xxxxxxxxx : xxxxxxxx<-- 

CLASS 
 public class SaveFrame: 
 --> in public void firstInstance() var: xxxxxxxxx : xxxxxxxx<-- 
 : true: bCreated target :
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.