JTextPane and EditorKit

Discussion in 'Java' started by Jason Cavett, Jun 30, 2008.

  1. Jason Cavett

    Jason Cavett Guest

    I'm a little confused about how to use an EditorKit along with a
    JTextPane. Basically, I want to write my own EditorKit that I will
    attach to a JTextPane. When any text is put into the JTextPane, the
    EditorKit will be responsible for properly parsing/formatting the text
    so it displays correctly in the JTextPane.

    Is this the correct way of thinking (AKA, is that a purpose of the
    EditorKit)? Any advice on where to begin (I haven't had much luck so
    far).


    Thanks
    Jason Cavett, Jun 30, 2008
    #1
    1. Advertising

  2. In article
    <>,
    Jason Cavett <> wrote:

    > I'm a little confused about how to use an EditorKit along with a
    > JTextPane. Basically, I want to write my own EditorKit that I will
    > attach to a JTextPane. When any text is put into the JTextPane, the
    > EditorKit will be responsible for properly parsing/formatting the text
    > so it displays correctly in the JTextPane.
    >
    > Is this the correct way of thinking (AKA, is that a purpose of the
    > EditorKit)? Any advice on where to begin (I haven't had much luck so
    > far).


    Starting from scratch may be a bit daunting. Have a look at the series
    EditorKit -> DefaultEditorKit -> StyledEditorKit -> HTMLEditorKit or
    RTFEditorKit. Pick one that's close to your document format. Try it out
    to see how much you'd have to change. Here's an example of displaying an
    HTML document, using the HTMLEditorKit by default:

    <http://robotchase.svn.sourceforge.net/viewvc/robotchase/trunk/src/org/gc
    s/robot/RCHelp.java?view=markup>

    I decided I could live with HTML 3.2:)

    --
    John B. Matthews
    trashgod at gmail dot com
    home dot woh dot rr dot com slash jbmatthews
    John B. Matthews, Jul 1, 2008
    #2
    1. Advertising

  3. Jason Cavett

    Jason Cavett Guest

    On Jun 30, 9:46 pm, "John B. Matthews" <> wrote:
    > In article
    > <>,
    >  Jason Cavett <> wrote:
    >
    > > I'm a little confused about how to use an EditorKit along with a
    > > JTextPane.  Basically, I want to write my own EditorKit that I will
    > > attach to a JTextPane.  When any text is put into the JTextPane, the
    > > EditorKit will be responsible for properly parsing/formatting the text
    > > so it displays correctly in the JTextPane.

    >
    > > Is this the correct way of thinking (AKA, is that a purpose of the
    > > EditorKit)?  Any advice on where to begin (I haven't had much luck so
    > > far).

    >
    > Starting from scratch may be a bit daunting. Have a look at the series
    > EditorKit -> DefaultEditorKit -> StyledEditorKit -> HTMLEditorKit or
    > RTFEditorKit. Pick one that's close to your document format. Try it out
    > to see how much you'd have to change. Here's an example of displaying an
    > HTML document, using the HTMLEditorKit by default:
    >
    > <http://robotchase.svn.sourceforge.net/viewvc/robotchase/trunk/src/org/gc
    > s/robot/RCHelp.java?view=markup>
    >
    > I decided I could live with HTML 3.2:)
    >
    > --
    > John B. Matthews
    > trashgod at gmail dot com
    > home dot woh dot rr dot com slash jbmatthews


    It's working. Thanks, John for the suggestion.
    Jason Cavett, Jul 8, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rj

    JTextPane columnar data

    rj, Sep 1, 2003, in forum: Java
    Replies:
    1
    Views:
    490
    Sandip Chitale
    Sep 1, 2003
  2. Adam
    Replies:
    0
    Views:
    436
  3. Terry
    Replies:
    0
    Views:
    432
    Terry
    May 4, 2004
  4. Kalpesh Modha

    JTextpane and mxing with HTML.

    Kalpesh Modha, Sep 13, 2004, in forum: Java
    Replies:
    3
    Views:
    451
    Andrew Thompson
    Sep 13, 2004
  5. Ed Dana

    JTextPane and URL Paths.

    Ed Dana, Oct 17, 2006, in forum: Java
    Replies:
    0
    Views:
    426
    Ed Dana
    Oct 17, 2006
Loading...

Share This Page