• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"Error cannot find symbol" "throws BadLocationException"

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the error that it is the thread title when running this code:

The error began to show up when I added this three lines related to the Highlighter. I think it might be related to the index that I am passing to addHighlight but I am not sure.
Anyone has an idea about what can be?
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
- for better help sooner post an http://sscce.org/, short, runnable, compilable with hardcode value for Document as local variable,

- no idea if Highlighter is applied on runtime or on apps startup (quite doesn't matter is required an SSCCE)
 
Andre Rossi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the error that it is the thread title when running this code:




The error began to show up when I added this three lines related to the Highlighter. I think it might be related to the index that I am passing to addHighlight but I am not sure.

I made I self-contained version of the error here:

But with this code I don't get the same error.....what I am getting now it is a nullPointerException in line 24 the one
The frame is created shows the two first words before generating the error.

Anyone has an idea about what can be?

I also would appreciate if someone can provide me a few tips, links or whatever about how I can advance in text using the keyboard. In another words, if I press right it advances until a certain occurrence of a certain word, then if I press again, it advances to the next one until I reach the last occurrence of a word.
 
Andre Rossi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darryl Burke wrote:Please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/79716-error-cannot-find-symbol-throws-badlocationexception.html
http://www.javaprogrammingforums.com/awt-java-swing/30250-error-cannot-find-symbol-throws-badlocationexception.html



Shall I edit the first post and put these links there?

I received this suggestion in one of the forums

I have not used the Highlighter class before. But I suggest you move the hilit and painter definitions outside the loop. I believe they can be allocated once for subsequent highlighting ahead of time. Then you need to set the highlighter in your JTextArea object using ta.setHighLighter(hilit). I believe there will still be problems with the coordinates you are highlighting but the exceptions go away.



And I tried this

But this is leaving to this:


error: cannot find symbol
ta.setHighLighter(hilit);

>
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is case sensitive, and there is a wrong case somewhere in that method name.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic