Adding / Removing Highlights in Swing

Posted on 2006-04-28
Last Modified: 2006-11-18
I'm working with an application that can highlight certain entries in a document.  It uses a .properties file to hold all the highlights, and currently, removing a highlight involves modifying the .properties file, and refreshing the entire application.  This takes too long.  Is there a way to add/remove highlights without saving changes to a .properties file and / or refreshing?

Question by:swp3h6
    LVL 86

    Accepted Solution

    LVL 15

    Assisted Solution

    > This takes too long.  Is there a way to add/remove highlights without saving changes to a .properties file and / or refreshing?

    Simple of your using your using or extending DefaultHighlighter there is a method called removeHighlight and this is how I use it:

        public void removeHighlight() {
    LVL 15

    Expert Comment

    > Simple of your using your using

    Typo what I mean is if your using ;)

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    This video teaches viewers about errors in exception handling.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now