Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Showing different color texts on a text control in Java

Thread view: 
lrantisi - 09 Nov 2006 20:18 GMT
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.
Oliver Wong - 09 Nov 2006 20:19 GMT
> 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.

See
http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html

   - Oliver
RedGrittyBrick - 10 Nov 2006 20:47 GMT
> 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);


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.