How to highlight text with a translucent color

I have to highlight text from a JTextArea, but the color is too dark... So I'd like to highlight with a translucent color. How can I do it ?
Here is my code :
JTextArea jt;
int beginSelect;
int endSelect;
Highlighter hl = jt.getHighlighter();
DefaultHighlighter.DefaultHighlightPainter hld = new DefaultHighlighter.DefaultHighlightPainter(Color.BLUE);
try {
hl.addHighlight(beginSelect, endSelect, hld);
catch (BadLocationException e) {}
Thank you.

import javax.swing.plaf.*;
        Color color = new Color(220, 200, 240, 150);
        ColorUIResource colorResource = new ColorUIResource(color);
        UIManager.put("TextArea.selectionBackground", colorResource);Default for windows is [r=49, g=106, b=197]
and for metal is [r=204, g=204, b=255].

Similar Messages

  • How to highlight text with Adobe Reader XI?

    email [email protected]

    Thanks. The PDF file was made from a web site article and I guess this is the same as scanned as I cannot highlight.  The cursor changes but cannot highlight what I want.
    I was able to add text and I did this in Red and will ask the VA to read under the sections marked in Red.
    Thanks,
    Vernon Pobanz
          From: ~graffiti <[email protected]>
    To: vernon pobang <[email protected]>
    Sent: Tuesday, October 7, 2014 11:57 AM
    Subject:  How to highlight text with Adobe Reader XI?
    How to highlight text with Adobe Reader XI?
    created by ~graffiti in Adobe Reader - View the full discussionUse the highlight tool under Comment>Annotations. This will only work if the pdf isn't a scanned image. If that is the case, there is no text to highlight. Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6800192#6800192 Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:  To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.  Start a new discussion in Adobe Reader by email or at Adobe Community For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How Do highlight text in the body of an email message in Mac Mail?

    Can anyone tell if IF and HOW I can highlight text in the body of an email message using Mac Mail (in Yosemite).  I do NOT mean MARKUP an attachment.  I want to highlight a word or phrase in the body of my email message.  I know I can change the font color, but can't seem to add a highlight!  Thanks!

    Hi,
    is is possible, - link is below. Works on Yosemite, btw.
    http://www.mihalick.us/how-to-highlight-text-in-yellow-using-apple-mail/

  • Why can I now highlight text with mouse pointer in Adobe Reader 9

    I just downloaded Adobe Reader X. I think I prefer Reader 9. I don't like being able to click in the document and have a flashing place mark (right terminology?) there. This is now happening in the Reader 9 version too, and I can copy text this way, but I don't want this. I didn't change any preferences. Can anyone help?

    Like I said, I didn't change any of the preferences, so I don't know why this happened. I think it only happened after I opened Adobe Reader X. I see no options in preferences for turning on or off the ability to highlight text with your mouse pointer, and I thought you were not supposed to be able to do this in Adobe Reader 9.

  • How to highlight text in the iCloud web app

    Hi,
    My computer recently broke so I had to use my mom's windows computer to do my homework. I had to use the iCloud web app Pages to do my homework. My assignment requires to be able to highlight stuff so does anyone know how to highlight text in the iCloud web apps?

    You can do this easily by using a "modify class" parameter in your web template.
    Following methods are of your interest to change char/KF headers.
    CAPTION_CELL          changes formats/values of characteristic headers
    STRUCTURE_CELL          changes formats/values of key figure headers
    Hope it helps.
    Hari Immadi
    http://immadi.com
    SEM BW Analyst

  • Does anyone know how to highlight text within a mac mail message?

    Does anyone know how to highlight text within a mac mail message?

    I can't find that option in Mac Mail's editor.  You can use a more feature rich editor like OpenOffice or Pages to create your message.  Then copy/paste into mail.
    Dan

  • How do I text with the iPad 2 using cellular device?

    How do I text with the iPad 2 using cellular device? I also have iPhone 4, can I use them both for texting?

    The iPad doesn't have any text over cellular capabilities. You can use apps like Text Free to send texts to non-iOS devices, though.

  • How do I know if my mouse is bad?  I'm having trouble highlighting text with my mouse, model A1152

    How do I know if my mouse needs to be replaced or if it something else?  I am having increasing trouble highlighting text, it either won't hold the highlighting, or it won't highlight . . . making it impossible to create a link in my emails, to delete text, or copy and paste.
    I have an iMac that is about 4 years old and the mouse that came with it uses a USB port to connect.
    Thanks for any information or suggestions.

    Is it one of those with a little moving/rotating ball on the bottom of it? Have you ever taken that out and cleaned it and the area holding it? It could be dust/dirt in there. I always used a QTip slightly moistened with alcohol.

  • AppleScript Needed...How to tell Pages to delete all texts with a specific color?

    How to tell Pages to remove all texts with the font size: 13 and color " disabledControlTextColor" from the developer palette?

    Sorry John,
    Now My question has changed,
    Now I want to fill the whole cell with a color , not only the text background
    Now I have the Solution. As from the previos post itself I got the Answer. I excuse all of u to put the related question in a new thread.
    Please leave it. I won't repeat it.
    <af:column sortProperty="Salary" headerText="#{bindings.EmployeesVO1.hints.Salary.label}"
    inlineStyle="#{row.Salary>'20000'?'background-color:Red;':'background-color:Orange;'}"
    id="c6">
    <af:outputText value="#{row.Salary}" id="ot4">
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.EmployeesVO1.hints.Salary.format}"/>
    </af:outputText>
    fixes my issue.
    Ranjith C
    Edited by: Ranjith C on Jun 30, 2011 4:46 AM

  • How to Highlight text in DW?

    I've been trying to find an easy way to highlight my text
    with yellow or some other colors. It looks like in DW you need to
    go through 1.5 Mil steps and maybe and hopefully this thing could
    get done. I appreciate if any of you know an easy way to
    highlight/shade the text in DW.
    Thanks.

    <p>This is an <span
    style="background-color:yellow;">example</span> of
    highlighted text.</p>
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Alex2378999" <[email protected]> wrote in
    message
    news:f8g0kc$dhk$[email protected]..
    > I've been trying to find an easy way to highlight my
    text with yellow or
    > some
    > other colors. It looks like in DW you need to go through
    1.5 Mil steps and
    > maybe and hopefully this thing could get done. I
    appreciate if any of you
    > know
    > an easy way to highlight/shade the text in DW.
    >
    > Thanks.
    >

  • How to highlight text in pdf file programmatically

    I am using below mentioned code to highlight text programmaticaly using VB.net But required text is getting selected but doen't get permanently highlighted. Can anybody help me out.
    Dim gAvDoc As
    Acrobat.CAcroAVDoc 
    Dim myhitlist As
    Acrobat.CAcroHiliteList 
    Dim mypdpage As
    Acrobat.CAcroPDPage 
    Dim acroPageView As
    Acrobat.CAcroAVPageView 
    Dim textSelect As
    Acrobat.CAcroPDTextSelect 
    Dim gPDFPath As
    String
    Dim gApp AsAcrobat.AcroApp 
    gPDFPath =
    "C:\Test.pdf"
    gApp = CreateObject("AcroExch.App") 
    gApp.Show()
    gAvDoc = CreateObject("AcroExch.AVDoc") 
    gAvDoc.Open(gPDFPath,
    "")acroPageView = gAvDoc.GetAVPageView()
    acroPageView.GoTo(1)
    myhitlist = CreateObject(
    "AcroExch.HiliteList")myhitlist.Add(50, 10)
    mypdpage = acroPageView.GetPage()
    textSelect = mypdpage.CreateWordHilite(myhitlist)
    gAvDoc.SetTextSelection(textSelect) 
    gAvDoc.ShowTextSelect()
    gAvDoc.Close(True) 

    Patrick on writting saving code also its not hightlighting the text. Text gets selected but it doen't get highlighted with yellow color...
    Dim gAvDoc As
    Acrobat.CAcroAVDoc 
    Dim myhitlist As
    Acrobat.CAcroHiliteList 
    Dim mypdpage As
    Acrobat.CAcroPDPage 
    Dim acroPageView As
    Acrobat.CAcroAVPageView 
    Dim textSelect As
    Acrobat.CAcroPDTextSelect 
    Dim gPDFPath As String 
    Dim gApp As Acrobat.AcroApp 
    Dim mypddoc As Object
    gPDFPath ="C:\Test.pdf"
    'Initialize Acrobat by creating App object
    gApp = CreateObject("AcroExch.App")mypddoc = CreateObject(
    "AcroExch.PDDoc") 
    gApp.Show()
    mypddoc.Open(gPDFPath)
    gAvDoc = CreateObject("AcroExch.AVDoc") 
    gAvDoc = mypddoc.OpenAVDoc("testing")acroPageView = gAvDoc.GetAVPageView()
    acroPageView.GoTo(1)
    myhitlist = CreateObject(
    "AcroExch.HiliteList")myhitlist.Add(50, 10)
    mypdpage = acroPageView.GetPage() 
    textSelect = mypdpage.CreateWordHilite(myhitlist)
    gAvDoc.SetTextSelection(textSelect)
    gAvDoc.ShowTextSelect()
    mypddoc.Save(PDSaveFull, gPDFPath)
    gAvDoc.Close(True)

  • How to highlight text in JTextField?

    Hi all, I know this is a very simple question but I just couldn't find its solution and I'm rushing for my project.
    My question is: how to highlight all the text in JTextField when it gets focus?
    Thanks a lot in advance!
    Janet

    You have to add a FocusListener in the JTextField and override the focusGained() method to select all the text with JTextField.selectAll().
    class MyFrame {
      JTextField text = new JTextField();
      // when creating the frame
      text.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
          doSelectAllText(); 
      void doSelectAllText() {
        text.selectAll();
    }Hope this help.

  • How to highlight text in JLabel????

    I m writing code for find functionality(similar to ctrl+f )..
    I have a JTable with some of its cell contains JLabel...
    I want to highlight some part of text from JLabel using using tableCellRenderer
    (eg. text on JLabel is "India" & my search keyword is "In", then only first two letters of JLabel should get highlighted)..
    It works, if Jtable contains string but not for any JComponent(like JLabel, JPanel, JCheckBox etc..) ..
    Please help me out for this....
    NOte: ---
    I m posting some part of code that i have used to highlight string in a JTable cell..
    public Component getTableCellRendererComponent(JTable table, Object value,
                                                         boolean isSelected, boolean hasFocus, int row, int column) {
                 // method to highlight WORD depending upon condition..
                           try {
                              high.addHighlight( i, j, highlight_painter );          // method to highlight word
                         catch (Exception e) {
                              e.printStackTrace();
                return this;
            }thanks in advance
    suyog

    I am posting my code that i am using for highlighting text in JTable...
    But this code is not working, if cell contains JLabel...
    Can you please suggest me any solution to work this code for JLabel with plain text content & with hyperlink (formatted using HTML tags), with out affecting to its original functionality
    (I am not getting what cramick want to suggest... )
    public class TableCellRendererBug{
         // code to highlight the specific WORD in JTable
         Vector vrecord;          // vector used in condition to highlight
         JTable tab;
         public  DefaultHighlighter high ;
             public void highlightWord(JTable table,Vector record){
                  tab=table;
                  vrecord =new Vector(1);
                  vrecord=record;
                  tab.setDefaultRenderer(Object.class, new CellHighlightRenderer());
        class CellHighlightRenderer extends JTextField implements TableCellRenderer {
              DefaultHighlighter.DefaultHighlightPainter highlight_painter =
                        new DefaultHighlighter.DefaultHighlightPainter(new Color(198,198,250));
             public  DefaultHighlighter high ;
            public CellHighlightRenderer() {
                 high = new DefaultHighlighter();       
                 setBorder( BorderFactory.createEmptyBorder() );
                setHighlighter(high);
                  tab.updateUI();
            public Component getTableCellRendererComponent(JTable table, Object value,
                                                         boolean isSelected, boolean hasFocus, int row, int column) {
                 // method to highlight WORD depending upon condition..
                    setFont(table.getFont());
                setValue(value);                    // intialize object
               *    condition to execute addHighlight..
               *    Here i am using  above mentioned Vector & all the things
               if(condition){
                          try {
                              high.addHighlight( start, end, highlight_painter );          // method to highlight word
                         catch (Exception e) {
                              e.printStackTrace();
                     }//if
                return this;
            protected void setValue(Object value) {
                 // method to initialize value of object
                 setText((value == null) ? "" : value.toString());
    }Thanks In advance..
    Suyog

  • How to highlight text in a text box

    In Acrobat 5 Pro you could highlight text created with the "FREE TEXT TOOL", I understand this has been renamed the "TEXT BOX TOOL" in Adobe 9 Pro. I can not highlight text created with the text box tool, can anyone help.
    Thanks,
    Jim E.

    Have you tried the text touchup tool, select the text you want, and right click for the properties. I do not think you can highlight in a text box (the form tool for text).

  • Vim keeps freezing and I cannot highlight text with my mouse

    title says it all.  Vim will freeze on me randomly.  I was having X issues earlier but stopped using the nvidia driver and that seemed to fix that, but now Vim freezes.  I'll be in Insert mode and it simply will not accept any of my keystrokes or attempts to esc to command mode.
    Eventually it'll unfreeze and then process all the keys I pressed while it was frozen (about 1-2 minutes later).
    The only thing going on in my .vimrc is a color scheme.  This happens in urxvt, in an ssh shell, and in screen.   
    And for some reason I can't used my mouse to highlight text in vim either in all the shells previously listed.

    Try resetting the SMC and PRAM.
    Barry

Maybe you are looking for