Saving text and pics......... please

hi
ive a prob with object cerialization. some text and pictures are in the JTextPane and they have to be saved in file. in many books only few things are given about cerialization. please give me a link to sort out my problum. and any example if u can pl pl pl....
thanks....

DefaultStyledDocument already implements Serializable.
public class DocumentIO {
     public static DefaultStyledDocument load(String fileName) {
          try {
               ObjectInputStream in = new ObjectInputStream(new FileInputStream(fileName));
               DefaultStyledDocument document = (DefaultStyledDocument)in.readObject();
               return(document);
          catch(Exception e) {
               System.out.println("Error when loading "+fileName);
               return(null);
     public static void writeKey(DefaultStyledDocument document, String fileName) {
          try {
               ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(fileName));
               out.writeObject(document);
               out.close();
          catch(Exception e) {
               System.out.println("Error when saving to "+fileName);
}Denis

Similar Messages

  • Updateable blog containing text and pics

    Hi,
    I've managed to create a text box that displays text
    contained within a text file in the same directory as the swf.
    Now the user wants this to be a scrollable blog where they
    can add text and pics as and when they need to.
    Is there a way to do this in Flash? If so can anyone help me
    out?
    Any help will be much appreciated.
    Cheers

    Yes, there is. Without going into pages and pages of detail,
    I'd suggest starting by looking at the HTML tags available in
    flash, including the img tag. Alternatively, flash supports CSS, so
    you may want to read into that as well.

  • Saving text and image

    I have an application where I need to save both text and image.
    this is controlled by the menu
    when I press save I want to be able to save either a text file or an image file.
    How can I do this.
    below is a sample of what I have been trying
    else if (source == menuSave)
    //             File.getName().toLowerCase().endsWith(".jpg");
               saveimage();
    //           if(File.getName().toLowerCase().endsWith(".txt"))
               savetext();both saveimage() and savetext() are independent functions

    I have an application where I need to save both text
    and image.
    this is controlled by the menu
    when I press save I want to be able to save either a
    text file or an image file.
    How can I do this.
    below is a sample of what I have been trying
    else if (source == menuSave)
                 File.getName().toLowerCase().endsWith(".jpg");
    saveimage();
    if(File.getName().toLowerCase().endsWith(".txt"))
    savetext();both saveimage() and savetext() are independent
    functionsFor saveimage, I think you could use ImageIO#write() method.
    For savetext, you could use simple PrintWriter.

  • How can u tell if someone is tracking ur for and can read all your text and pic message from home computer

    Help

    I think my wife has found a way too look at my iPhone from home computer she's got a history I had a blackberry and she did with it and it messed my phone up I'm having problems with my iPhone she calls when I'm on the Internet and just some comments she made knows too much I know she's looking from home computer just like too find how my battery don't last but when I'm home it last and my phone gets hot on the back I think when I get a email and text pic message it goes too her the too me lately when I send a pic or a text to my friend on group message some of the don't get nothing

  • Saving ringtones and pics

    I have an 8310, and have put in a 2GB microSD card into my phone and I have it set up so that anything new gets saved onto the media card. Its been working well for a while now, but all of a sudden now when I try to save a new ringtone or picture, it says "File system out of resources." I have checked in the options menu, and for my media card, it says I still have 1.8GB left so now I'm not sure what to do. Can anyone help?

    Hi WickedFreak!
    Check to ensure that when you are saving the file, you are indeed attempting to save it on the media card. 
    Remove the battery and media card for 10 seconds and reinsert them, media card first.
    If all else fails, try copying the data from the media card to your pc and formatting it (options, media card or options, advanced options, media card - hit your menu button and select format.  This will erase all the information on the media card) 
    Cheers! 

  • I need to know how to edit a drawing - basically remove the arrows and text but at the same time match the background of the existing pic. then re add new text. how do i erase the arrows and text and arrows but match current background of pic. step by ste

    i need to know how to edit a drawing - basically remove the arrows and text but at the same time match the background of the existing pic. then re add new text. how do i erase the arrows and text and arrows but match current background of pic. step by step explanation please beginner

    Please post (a relevant section of) it right on this Forum.

  • Hit "Save as Adobe pdf" and pic came out on top of text box.

    Win 7.0 64 bit, acrobat 11.0.10 word 2010, created a .docx file woth a pic and a tex box on top of pic.- hit Save as Adobe pdf and pic came out on top of text box.

    Hi wmckb,
    Please try using PDF Maker option in word and check if the same problem arises.
    Hope to hear from you.
    Regards,
    Anubha

  • Problems texting and send pics

    My boyfriend has a Andriod cellphone and I have a Iphone 5. About 3 days ago he couldn't text me, but I still could text him, what is the problem. I now can't send him pics now either. This is so frustrating. I don't know who has the problem I keep thinking its his phone and not mine. Most everyone else I text and coommunicate with has a Iphone and can text and send pics to them? Please help. Any ideas????????
    Sincerely
    Darcey

    Ask your phone carrier, as SMS and MMS is a carrier feature.
    Make sure MMS is turn on in message settings.

  • I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    Plawexki wrote:
    ...  do you know if the contacts, photos, messages etc will be wiped?
    Yes... Everything will be Wiped and Replaced with what is currently on Your Mac.
    SYNCING with iTunes
    See here  >  http://support.apple.com/kb/HT1386
    From Here  >  http://www.apple.com/support/iphone/syncing/
    You may find this information of interest...
    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • My daughter has an iPhone and some how we share an iCloud account and she's getting all my texts and contacts. I can't find where to uncheck her phone number on my phone account. Please help

    My daughter and I both  have an iPhone and some how we share an iCloud account and she's getting all my texts and contacts. I can't find where to uncheck her phone number on my phone account so she doesn't get all my texts and contacts. Please help

    Hi Shellyk,
    Go to Settings>Messages>Send & Receive and make sure that only your personal email addresses are listed under the individual phone number.Remove the "shared" iCloud email address.
    For the Contacts, if you are syncing them via iCloud and you both have the same iCloud account, you will both have the same Contact list.
    Cheers,
    GB

  • Itunes on Windows 7 only displaying icons and pics? Text has disappeared?

    Itunes on Windows 7 only displaying icons and pics? Text has disappeared? Library content is still there but all text details now missing

    Same problem here!  Driving me nuts that it is somehow "running" as shown in the task bar, but it is not accessible in any way.

  • After saving a pdf as Excel workbook the numbers remain text and cannot be used in calculations. Is there a better way to convert into real digital numbers?

    After saving a pdf as Excel workbook the numbers remain text and cannot be used in calculations. Is there a better way to convert into real digital numbers?
    I have tried to convert the pdf to Word instead but same difficulty with numbers: look like numbers but not usable for calculations

    Excel has a 'text to numbers' function, I would use that.
    Convert text to numbers. Microsoft Excel.

  • TS3406 I have a connection in the top left hand corner and can access the internet with and without internet on my iphone 5c but I can't receive and create texts and calls, someone please help have tried everything!

    I have a connection in the top left hand corner and can access the internet with and without internet on my iphone 5c but I can't receive and create texts and calls, someone please help have tried everything!

    YOu will need to contact your cell phone provider to resolve those issue, those are carrier features.

  • Illustrator abruptly closed my saved file and said it cannot open the illustration. It says it contains illegal operand. Offending operator: 1. #INF. Can anyone please help?

    Illustrator abruptly closed my saved file and said it cannot open the illustration. It says it contains illegal operand. Offending operator: 1. #INF. Can anyone please help?

    What exactly did it do?
    Crash while saving a file? That most probably ruins a file.
    You can try and create a new Illustrator file, then place the old one in it. If that doesn't work, You might need to search for a backup.
    Don't have a backup?
    Start using the (free) plugin Autosaviour, use Time Machine (or whatever your system offers as a backup software)

  • What's the best App for downloading, editing and saving Microsoft Excel spreadsheets please?

    What's the best App for downloading, editing and saving Microsoft Excel spreadsheets please?

    You can have a look at Quickoffice
    http://i1224.photobucket.com/albums/ee374/Diavonex/74fb0e85.jpg

Maybe you are looking for

  • How to show error message on page #NOTIFICATION_MESSAGE#?

    Hi, Is it possible to show error message on a page, where apex substitutes #NOTIFICATION_MESSAGE# at page template, with a javascript call? My requirement is to report error messages which i get from ondemand process, these on-demand processes were c

  • Can't Scan after new installation

    A bit of background; Dell laptop Windows 8.1 64bit HP Officejet 6500 e709n I finally managed to install the full set of printer drivers (HP Solution Center) on this new laptop ....which btw took hours of research,  just to learn that I can't scan.  I

  • Using Javascript to print and close window

    I found that I could open my document in a browser and using Javascript, automatically bring up a print dialog and send it to the printer. My problem is that this document opens in a browser that is being used as a kiosk touch screen with no address

  • P2P blocking on ASA 5525 with Software Version 8.6(1)2

    Hello, We have Cisco ASA 5525 with Software Version 8.6(1)2. We have permitted all the traffic from inside to outside. Now we want to block P2P sharing Bit torrent to internet sites. Please help me with the configuration. We have DMZ setup & also inl

  • Home page won't load on start up it goes to the last page it was on before the shut down.

    It started just recently where I exit FIrefox and then restart it either after the computer has rebooted or closed by accident, it always brings back the tabs and pages I was on at the time of shut down. I have looked on here and tried what others ha