Showing different color texts on a text control in Java

Discussion in 'Java' started by lrantisi, Nov 9, 2006.

  1. lrantisi

    lrantisi Guest

    Is there a text control in Java that I can use to show texts with
    different colors at the same time. Like showing a word in Red and
    another one in blue at the same time on that control.
     
    lrantisi, Nov 9, 2006
    #1
    1. Advertising

  2. lrantisi

    Oliver Wong Guest

    Oliver Wong, Nov 9, 2006
    #2
    1. Advertising

  3. lrantisi wrote:
    > Is there a text control in Java that I can use to show texts with
    > different colors at the same time. Like showing a word in Red and
    > another one in blue at the same time on that control.
    >


    Lots.

    String labelText =
    "<html>Foo " +
    "<font color=\"red\">bar</font>" +
    " baz " +
    "<font color=\"blue\">qux</font>" +
    " quxx " +
    "</html>";
    JLabel label = new JLabel(labelText);
    aPanel.add(label);
     
    RedGrittyBrick, Nov 10, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    334
  2. lrantisi
    Replies:
    0
    Views:
    297
    lrantisi
    Nov 9, 2006
  3. Kamaljeet Saini
    Replies:
    0
    Views:
    493
    Kamaljeet Saini
    Feb 13, 2009
  4. Replies:
    7
    Views:
    410
    Mick White
    Feb 2, 2005
  5. Replies:
    1
    Views:
    309
    marss
    Feb 14, 2007
Loading...

Share This Page