Different Colored Highlights in JEditorPane

Hello there,
I have a question regarding different highlights. I have multiple highlights in different color. Is there any way I can selectively remove highlights.
Meaning say, I have two highlights one with red colored painter and another with green colored painter. Then is there a way, wherein I can remove highlight for the highlight in green color while retaining the highlight in red color.
I did something like this
Highlighter.Highlight[] selections= edit.getHighlighter().getHighlights();
for (int i=0; i<selections.length; i++) {
Highlighter.HighlightPainter painter= selections.getPainter();
//DefaultHighlighter.DefaultHighlightPainter painter
//Color clr = painter.getColor();
But the getColor() method is there only in DefaultHighlighter.DefaultHighlightPainter and not in Highlighter.HighlightPainter.
May be I am missing some small thing.
Thanks a lot for your help.

But the getColor() method is there only in DefaultHighlighter.DefaultHighlightPainter and not in Highlighter.HighlightPainter.So cast the Highlighter... to a DefaultHighlighter...
Highlighter.Highlight[] highlights =      textPane.getHighlighter().getHighlights();
for (int i = 0; i < highlights.length; i++)
     Highlighter.Highlight h = highlights;
     DefaultHighlighter.DefaultHighlightPainter thePainter = (DefaultHighlighter.DefaultHighlightPainter)h.getPainter();
     System.out.println( thePainter.getColor() );

Similar Messages

  • How to print different colors of Strings into JEditorpane?

    How to print different colors of Strings into JEditorpane?
    Can any body give me answer ...

    JEditorPane contain HTML. So write your HTML using the color attribute.
    Start by read the the API description of JEditorPane. you will find a link to the Swing tutorial on "Using Text Components" which has working examples of using a JEditorPane. It also has an example of using a JTextPane where you can dynamically change the attributes of individual pieces of text.

  • How to highlight search term in a different color in search results?

    Hi
                  How can I highlight search term in a different color in the search results. Currently it is black, I would like to change it to green.
    Thanks in advance
    Regards
    Vidya

    Dear Bhanu,
    It might be possibe but i am not fully sure about it.
    try with different combination and check it.
    I need to check whether it is feasible or not.
    Best Regards,
    Arun Jaiswal

  • How to highlight different color in bar chart above the mark

    Hi friends,
    I have a bar chart in which im displaying it in blue color in obiee 11g. In graph properties i have set a scale marker to the point 4000, so that a line is appearing horizontally at the point 4000 in the bar chart. My chart is exceeding above 4000, as it reaches upto 5000.
    I need to set a color to the graph such that from *0-4000, i need to have one color* and above from 4000-5000 i need to highlight it with a different color.
    How to possible it to highlight with different color above that *4000 mark in my bar chart*.
    Thanks
    All izz Well
    GTA

    From your initial post I thought you meant you wanted to change the colour of the bit above the line for every bar that went over the line.
    The solution above works because stacked bar will use different colours for different measures - by splitting your original measure into one measure for the data up to the line and another measure for any data above the line you achieve this. Bars that don't cross the line will only show one colour, bars that do cross the line will show two.
    eg
    original measure/new measure 1/new measure 2
    2000/2000/0
    3000/3000/0
    5000/4000/1000
    5500/4000/1500
    The other scenario is that you want the whole bar to be coloured if it crosses the line. If that's the case then there is a conditional formatting section under graph properties->style->style and conditional formatting.
    Regards,
    Robert

  • Why are filenames highlighted in different colors?

    Just upgraded from 10.2 to 10.4 i believe and im noticing filenames ALL OVER the place with different colors to them and i cant figure out any system to it, what is that all about?

    This means that the files have a label assigned to them; Mac OS X 10.2 will not display labels in the Finder but Mac OS 9.x, Mac OS X 10.3 and newer systems will. To turn off a label, control-click the file in the Finder and click the x furthest to the left under Color Label. The files may have color labels because they were set that way when they were placed onto the hard disk, or if the label has been changed after putting them on.
    (10677)

  • Different color text in text area???????

    hi,
    i am working on applet in which i want to show different color text in text area????????
    could any one help me

    I'm not sure it replies, we have developed an
    editorkit for the JEditorPane for colorizing a
    text with a property file describing a grammar. We
    provide in the packaging a trivial sample
    for coloring a java syntax in an applet.
    http://www.japisoft.com/syntaxcolor
    And of course it also requires that you buy it, and a.brillant forgot to mention that a.brillant has a financial interest in this product.

  • How to show alternate rows in different colors?

    How to show alternate rows in different colors?
    Thanks

    you should put these kind of stmt in the if condition for even row and odd row
    <xsl:attribute xdofo:ctx="block" name="background-color">yellow</xsl:attribute>
    this should help you
    Re: About highlight row
    http://blogs.oracle.com/xmlpublisher/2007/08/09
    http://garethroberts.blogspot.com/2007/09/bi-publisher-color-list-and-cell.html

  • PIE Chart Color Highlight - setting colors

    Hi
    PIE Chart showing default colors even after setting the diffent colors to OIE chart slices from Color Highlight tab.
    PIE chart is showing only one slice when I select Data for the PIE Char is "For all records".
    Could you please let me know how to set the different colors for slices?
    Thank you

    hi,
    As you are selecting 'Color Highlight' for different Pie Slices,  "For all records" option shouldn't be selected.
    It should be "On Change of".
    Then obviously you will see the colors specified in 'Color Hghlight' tab.
    Regards,
    Vamsee

  • How to underline with a different color than red (in Preview, with Mountain Lion)

    Hi,
    I'm using Preview to study and I would like to figure out how to underline with a different color please...
    Also, Is there a better app to read PDF document and highlight/annote/underline... to study...
    Thanks!

    In Adobe Acrobat Reader, you can control the color of the underline and the highlight from the Annotations panel. You would bring this into view from the View > Comment > Annotations menu hierarchy. The underline tool by default, has a green underline. You can change the color (and opacity) by right-clicking the green underlined ‘T’  and choose “Tool Default Properties.”
    This may have answered your second question if you find it easier to perform your markup with it.

  • Displaying different colors for cells/columns in Interactive Report

    Hi,
    I have a requirement to display just the 'cells' in the Interactive Report columns with different colors.
    There are 3 columns in the Interactive report.
    The color coding for all the 3 different columns should be such that:
    <40% - red color
    40-70-orange
    greater than 70%-green
    I tried the highlight option in the report and saved the report as default, but still the color condition ended up getting displayed to the end user. I dont want this.
    Can someone suggest a better way to handle this requirement?

    Perhaps explore similar solutions described here
    Background Colour of Report Cell Issues.
    Scott

  • Color Highlights does not work for chart

    When I set the color coding in the chart, it works fine if I run the crystal report on the same DB that I use to design the report.
    Problem occurs if I run the report on another DB. Color Highlights does not work in that case.
    I am using JRC to run the reports.
    Thanks & Regards,
    Amrita

    Hi Jehanzeb,
    In chart expert there is a tab "Color Highlightsu201D. In this tab one can specify the condition based coloring.
    In my case I want to show "RED" color for Unauthorized events andu201D GREEN" color for Authorized Events.
    While creating a report suppose I am using a database server "DB-A".I set the color highlights in the chart as I explained. Please be noted that when we click on the color highlights tab it asks for the database login.
    To view the report we have our own server and we are using JRC APIs.
    Hence I map my report with server and try to view the Report. My Server is connected with database "DB-B" which is different from the database I used to create the report.
    This time color Highlight I have specified while creating the report does not work.
    I have tried using the "Format Series Riser" option. But the problem with this is that, it does not color the chart conditionally.
    I mean if I give GREEN for Authorized and RED for Unauthorized. It gives the green color either to Authorized or Unauthorized which so ever occur first in the chart.
    For example:-suppose there is no Authorized Event on date 15-Jan-2009 and I select the date range starting from 15-Jan.In this case Unauthorized event is the first to print on the chart hence this event get the green color though I expect this events to be in RED color.
    Regards,
    Amrita

  • I have a question about the calendar on the ipad2. I have multiple calendars in different colors. Some of the events are filled in with color. Others are just listed with a colored dot in front of the event. Any ideas why events ar showing up differently?

    I have an ipad2 and my question is about the calendar. I set up multiple calendars with different colors. Some of the events show up in filled color. Others only show with a colored dot in front of the event. I can't figure out why some show up one way and others show up differently? Any thoughts?

    On mine the ones that show on a coloured background are all-day events, the ones with dots and just timed events.

  • Not able to color different rows with different colors in a column of table

    Hi,
    I am trying to to display different rows with different colors in a column of the table based on some decode condition.
    I have gone through the following threads :
    Can we colour the rows in the column of a table
    Changing Color of a value in a column
    This is what i have done :
    1.Added the following code to custom.xss(changed the name to Custom.xss as suggested in one of the above threads) --- in path ---- jdev\myhtml\OA_HTML\cabo\styles
    <style selector=".1">
    <includeStyle name="DefaultFontFamily"/>
    <property name="font-size">11pt</property>
    <property name="font-weight">Bolder</property>
    <property name="color">#008000</property>
    <property name="text-indent">3px</property>
    </style>
    <style selector=".2">
    <includeStyle name="DefaultFontFamily"/>
    <property name="font-size">11pt</property>
    <property name="font-weight">Bolder</property>
    <property name="color">#FFFF00</property>
    <property name="text-indent">3px</property>
    </style>
    2. Sql query of the VO is :
    select comments,role ,decode(role,'REQUESTER','1','2') Colorattr from xxat_sars_action_history where request_id = :1 and event_name = :2 and action_code <> 'PENDING'
    order by sequence_num desc
    3. Coded the following in the process request of the controller:
    OATableBean table = (OATableBean)webBean.findIndexedChildRecursive("CommentsTB");
    OAMessageStyledTextBean roleBN = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("role");
    OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(roleBN,"Colorattr");
    roleBN.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);
    where 1 and 2 form the colors ( i have even tried with 'Red' and 'Yellow'...as it was not working replaced with 1 and 2)
    4.The query returns data fine with corresponding 1 and 2 values.
    But different colors are not getting reflecting on to the UI.
    I am testing this on my local jdev.
    Please do let me know if i am missing something.
    Thanks ,
    Sushma.

    Any Clues please.....
    Thanks,
    Sushma.

  • How to Create Excel File in Background processing with different colors

    HI All
    I am trying to create Excel file in background & send it to user through e-mail, this i could acheive using fucntion module SO_DOCUMENT_SEND_API1, but here my requirement is i want to put different colors to columns of excel & this should happen in Background processing,
    Initially i completed above requirement by using HTML type of document with attachment type 'ALI'  & formatted output using write statement & used colors, after that i took this o/p using save_list function module & then table compress...etc.
    but i don't know how to achieve same if we need o/p in excel as size of object of excel file is less than that of HTML
    I am thankfull to everybody who will help me.
    Regards
    Lokesh

    Lokesh,
    Iam also trying to populate my text file with colors as an attachment . If you know this please let me know.

  • Different colors for the aggregation in the report

    Hi
    In my BEx report I require to show the aggregation in different colors.
    That is suppose my report has 3 characteristics and 2 keyfigures. When the 'Result' appears for characteristic1 it should be shown in blue color(not specific) and when the result appears for characteristic2 it should be shown in red color and when result appears for characteristic3 it should be shown in green color and similarly.
    Has any one already implemented this?
    Please help..
    Thanks and Regards,
    Satya Raj Kumar.

    Hi,
    Many thanks for your reply.
    But this is not what I am looking for.
    I require the result rows in different colors.
    Suppose the result row is based on aggregation of Characteristic 3 then the result row should appear in blue color.
    Suppose the result row is based on aggregation of Characteristic 2 then the result row should appear in green color. and so on.
    Please help on this.
    Thanks and Regards,
    Satya Raj Kumar.

Maybe you are looking for

  • EMac 700MHz display turned purple/pink. Can't boot from HD and CD

    hi, I have several issues here: 1) My eMac display turned purple/pink from the start 2) It won't start from either HD or CD. It gets to the grey Apple and the spinning wheel.. After a while of spinning, it freezes and nothing else I can do. This happ

  • Why does my Apple TV pause frequently to load?

    WHy does my Apple TV pause frequently to load?

  • How to find out image size (in pixels) of jpg and gif files

    this seems to work, though i doubt that it would very time:                Image img = Toolkit.getDefaultToolkit().getImage("car.jpg");                int w = img.getWidth(null);                int h = img.getHeight(null);                while(w <= 0

  • Authentication distance issues

    hello, I have the same issues on multiple access points (all cisco 1200s - in different sites) in which users cannot authenticate until they walk close to the AP. (a site survey was done before installation) - and I get good link quality from the use

  • Update primary key with a tabular form based on a select list for each row

    Hello! I've two tables: Table1 with only one column (primary key) is a foreign key for table2.column1 (primary key). There is also a second primary key column in table2. Now I want to change the primary key values in table2.column1 with a tabular for