Hi everyone,

I am currently trying to do a java package software that i will release as open-source. The software basically deals with clipboard operations. Basically what this software package does is to retrieve any kind of data be it an image or a jcomponent or formatted text and insert it into the jtextpane(or text component)
or vice-versa.

What i basically did was to build my own implementation of the windows clipboard and i have it about 80% working except for the last part.

I need a simple example on how to combine documents.
This was what i did but it did not work.
This is source snippet of the part i did to combine the two documents together.

public Document documentpaste ()
{
//All the variables have been declared somewhere above

try
{
File file3 = new File("C:/Final_Clip.dat");
FileOutputStream fStream = new FileOutputStream(file3, true);
ObjectOutput stream = new ObjectOutputStream(fStream);
stream.writeObject(Doc6);
stream.flush();
stream.close();
fStream.close();
}

catch (Exception e)
{

}

try
{
File file3 = new File("C:/Final_Clip.dat");
FileOutputStream fStream = new FileOutputStream(file3, true);
ObjectOutput stream = new ObjectOutputStream(fStream);
stream.writeObject(Doc7);
stream.flush();
stream.close();
fStream.close();
}

catch (Exception e)
{

}

try
{
File file3 = new File("C:/Final_Clip.dat");
FileInputStream fStream = new FileInputStream(file3);
ObjectInput stream = new ObjectInputStream(fStream);
Object obj = stream.readObject();
if(obj instanceof Document)
{
Doc8 = ((Document) obj);
}
stream.close();
fStream.close();
}

catch (Exception e)
{

}

return Doc8;

}

}

I hope you understand the code. What i heard is that i have to get the content of the document using element spec or something and combine them but i am really not sure how to do this part.

What i need is for someone to show me a example of combining the two documents together as a single document.

I hope i didn't bore anyone with this question of mine and wish that someone can help me with this problem.

My e-mail is freesoft_2000@yahoo.com

Thank You

Your Sincerely

Richard West