JTextComponent underliner

2003-09-12
2013-04-25
  • Jason Height
    Jason Height
    2003-09-12

    Hi all,

    Is or has anyone written code that can underline the misspelt words in any JTextComponent derivative? Is it already in Jazzy and i am missing something?

    Something like MS Word does, it draws a wavey line under any misspelt words.

    Ideally as i make changes the new words should be checked in the background. This would be a cool addition, but i am having difficulty in thinking how to do it efficiently and with the added problems of concurrently tracking edits. I was hoping it had already been done ;-)

    Jason

     
    • Ben Galbraith
      Ben Galbraith
      2003-09-12

      You know, I've been meaning to do this for a work project.

      I suppose the Swing way to do it would be to create an extended Document model that recognizes the notion of misspelled words, and a JTextArea descendent that decorates words accordingly.

      Are you up to collaborating on developing this component?

       
    • Hi everyone.

      I started to develop away of using jazzy in this way, marking misspelled word with a wavedline like in MS Word. But then I found out this had already been done by the two subclasses of EditorKit and Document in the swing directory. This way probably works fine even if it doesn't mark the words with a wavedline :-)
      But I would rather like to do it in a different way where you use a method in for example the JTextComponentSpellchecker class to start this type of spellchecking("startMarkedSpellcheck(JEditorPane pane)" or somthing). This method would then replace the JEditorPane's EditorKit with a new one that basically forwards all method but returns a new ViewFactory that also forwards calls to the original ViewFactory but adds the wavedline thingi. It would then add a DocumentListener to the JEditorPane to track changes to the document and spellcheck this parts.
      The benefits of this way of doing things, I think, would be that you can use the EditorKit and Document subclass of your choice and still be able to "mark" spellcheck your text.
      OK I will probably finish the implementaion of this anyhow, but I would like to know if you think it is a good idea to add this to CVS (When it is finished). Because it already exists a way of getting the basic functionality in a different way I don't want do step on anyones toes adding my own implementation.

       
    • Hi, again.
      OK so since no one has complained I've added the new implementaion of underlined or auto spellchecking. It would be great if you try it out since it might still have bugs in it (That I've not seen yet). :-)
      If you don't like it feel free to hate me, or you can just remove it ;-)

       
      • Hi Robert,
        Where can I try it out?

         
      • Enrico Goosen
        Enrico Goosen
        2006-06-08

        So where is this new implementation? I checked the cvs repository and didn't find it.
        If this functionality exists in Jazzy, it would be nice if there were documentation on how to make use of it.
        In fact, it would be nice if there was any documentation at all.

         
    • This is a great project. I adapted the code to work in a Java application-- we produce SpringCharts EMR, an electronic medical records software suite. We use the spell checker in messages, letters, patient charts. feel free to check it out; i will email you a demo.
      www.springcharts.com

       
    • Hi.
      Well since its rater new and untested it's not in the distribution. But you can test it by checking out the current version from cvs.
      Then you can try the TextPaneMarkingExample. You will probably have to edit the example to point at your dictionary and phonetic files.

       
      • Actually I've never used Jazzy before,
        so "edit the example..." means problems ;-))

        But I've tried...
        And it worked!, the example is pretty clean and nice, so thanks a lot.

        However you were right about it being untested, I've got the bug on underlining space between words, where should I report it?

         
        • OK, sorry hope it wasn't to much trouble.
          About the bug, it is reported now:-) I've had similar problems myself before, but I thought I had fixed them (Always a mistake). I will have a look at it again as soon as I can.

           
          • No problem really, that was kind of a joke. English is not my native language, so please forgive me.

            Maybe I'm blind (always suspected that, but so far no evidence ;-)) , but jazzy Bugs tracker doesn't list the bug:
            https://sourceforge.net/tracker/?group_id=34472&atid=411236

            So I've <a href="https://sourceforge.net/tracker/index.php?func=detail&aid=997173&group_id=34472&atid=411236">reported it</a>.

             
            • He he, OK.
              Nope your not blind;-) I just meant now I know about it so I'll have a look at it. But fileing it in the bug tracker is ofcourse even better, thank you:-)

               
        • There is an attempt to solve the problem available in cvs now. If you would like to try it.

           
          • Yes,
            the fix works (for me at least),

            so I closed the bug

            Thanks,
            Maxym

             
    • Anup
      Anup
      2005-12-04

      Any progress/update on the auto-spell checking? I am a complete newby to Java, as I use the Jazzy plugin for JEdit, and am desperate to see this working. If I get the latest code from SourceForge CVS what do I need to do to update the Jazzy plugin for me to try it out?

       
    • Alex
      Alex
      2006-03-13

      OK, I addressed this in JClaim.
      go take a look at the SVN.  it's in the ui...util package.

      You'll need more than an underliner.  You'll need the main part - the way to run the spell checking for multiple components and fast.

      Please note the project is GPL.

      Could also use any updates, if you make any.  And some credit would be nice ;)

      Enjoy.
      - Alex.