How to italic some texts in a JList

Discussion in 'Java' started by shoa, Apr 25, 2004.

  1. shoa

    shoa Guest

    Hello all

    I have JList with texts (I use labels for texts). Now I want to have some
    texts are italic, some are not. Could you please tell me how to do that

    Thank you for your help
    SHoa
    shoa, Apr 25, 2004
    #1
    1. Advertising

  2. shoa

    VisionSet Guest

    "shoa" <> wrote in message
    news:...
    > Hello all
    >
    > I have JList with texts (I use labels for texts). Now I want to have some
    > texts are italic, some are not. Could you please tell me how to do that
    >


    Read the API docs, JList extends JComponent, which has setFont(Font).

    --
    Mike W
    VisionSet, Apr 25, 2004
    #2
    1. Advertising

  3. On Sun, 25 Apr 2004 16:13:27 +0100, VisionSet wrote:

    > "shoa" <> wrote in message

    ....
    >> I have JList with texts (I use labels for texts). Now I want to have some
    >> texts are italic, some are not. Could you please tell me how to do that

    ....
    > Read the API docs, JList extends JComponent, which has setFont(Font).


    That would be the best way to go for italic,
    but if you needed something a little more,
    you could also use HTML as the text..

    <html><body>
    <p><i>italic <b>bold</b></i> text<sup>2</sup></p>
    </body></html>

    Note though, that the JVM needs to load
    a larger number more classes before it
    can render HTML, so Mike's method should
    be significantly faster.

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, Apr 25, 2004
    #3
  4. shoa

    Roedy Green Guest

    On Sun, 25 Apr 2004 15:41:53 GMT, Andrew Thompson
    <> wrote or quoted :

    >That would be the best way to go for italic,
    >but if you needed something a little more,
    >you could also use HTML as the text..


    The super fast approach, is to render with drawString in your own
    custom component. I posted an paint method yesterday that could be
    used to do generic text painting in a variety of fonts, styles,
    colours and sizes.


    The disadvantage is that the user cannot select/copy/paste. The
    result is a bit image the end user cannot manipulate or update.


    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Apr 25, 2004
    #4
    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. Music Lover

    Bold Italic UnderLine in TextBox

    Music Lover, Nov 26, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    811
    Teemu Keiski
    Nov 26, 2003
  2. Carlos Arra via .NET 247
    Replies:
    3
    Views:
    395
    Peter Brunone [MVP]
    Apr 26, 2006
  3. Replies:
    0
    Views:
    565
  4. Eddy Long

    Zapf Chancery ITC Italic

    Eddy Long, Dec 19, 2004, in forum: HTML
    Replies:
    2
    Views:
    6,201
    Eddy Long
    Dec 19, 2004
  5. Lloyd Zusman

    BlueCloth bold/italic problem.

    Lloyd Zusman, Nov 20, 2004, in forum: Ruby
    Replies:
    1
    Views:
    118
    Lloyd Zusman
    Nov 20, 2004
Loading...

Share This Page