5 Replies - 443 Views - Last Post: 12 March 2010 - 03:27 PM Rate Topic: -----

#1 Guest_jogendar*


Reputation:

saving text with styles in java

Posted 12 March 2010 - 08:57 AM

hello everyone,i am doing text editor in java,my problem is
"how to save the text in a textpane with its fontstyles in a file??"
Is This A Good Question/Topic? 0

Replies To: saving text with styles in java

#2 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: saving text with styles in java

Posted 12 March 2010 - 01:29 PM

Well what do you need help with? Saving to a file? Using the Font class? What?
Was This Post Helpful? 0
  • +
  • -

#3 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2586
  • View blog
  • Posts: 15,614
  • Joined: 24-September 08

Re: saving text with styles in java

Posted 12 March 2010 - 01:39 PM

Well, you could have your own algorithm for interperating data. Save the metadata at the front, read it bit by bit, and store them into variables to use later. So say you have a text file with a Times New Roman font. You could save it something like this:

Times New Roman%12%2.0$1.0%1.0%Once upon a time, there was a beautifull princess named NeoTifa. All the men loved her and stuff. To be continued....

So you would use % (just an example) as a demlimiter to read the data. You'd of course have to be very strict about the format, because as of right now, it's: font style, font size, spacing, vertical margins, horizontal margins, and then the contents of text file. I really don't know, as I've never really thought of it before, but I suppose this would work.
Was This Post Helpful? 1
  • +
  • -

#4 m-e-g-a-z  Icon User is offline

  • Winning
  • member icon


Reputation: 496
  • View blog
  • Posts: 1,453
  • Joined: 19-October 09

Re: saving text with styles in java

Posted 12 March 2010 - 01:43 PM

This might be of help..

Swing Advanced

This post has been edited by m-e-g-a-z: 12 March 2010 - 01:44 PM

Was This Post Helpful? 0
  • +
  • -

#5 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2870
  • View blog
  • Posts: 11,021
  • Joined: 15-July 08

Re: saving text with styles in java

Posted 12 March 2010 - 03:23 PM

View Posterik.price, on 12 March 2010 - 03:29 PM, said:

Well what do you need help with? Saving to a file? Using the Font class? What?


Exactly...

erik.price, why on EARTH did you link to roseindia? Have you seen their code?! However, you also linked to ESR's guide, so I forgive you.

OP, please clarify your question and show your code so that we can help you out.
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
Was This Post Helpful? 0
  • +
  • -

#6 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: saving text with styles in java

Posted 12 March 2010 - 03:27 PM

View PostDogstopper, on 12 March 2010 - 05:23 PM, said:

erik.price, why on EARTH did you link to roseindia? Have you seen their code?! However, you also linked to ESR's guide, so I forgive you.


First link on Google :P

Here's a better guide
http://java.sun.com/...l/essential/io/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1