Article View: borland.public.jbuilder.java.swing
Article #10613Re: Multiline text on JButtons?
From: Holger Stratmann
Date: Wed, 01 Sep 1999 00:00
Date: Wed, 01 Sep 1999 00:00
48 lines
2122 bytes
2122 bytes
> Anyone knows whether JButton is capable of displaying text in multiple
> lines? if so, how to?
This is from the "changes.txt" in Swing 1.1.1.
I haven't tried it myself, but maybe this helps:
=======================
HTML Text in Components
=======================
Although this release is largely a bug fix update, it adds one
new feature of note: many components can now contain HTML text.
These components include instances of JButton and JLabel (whose
HTML support was added in Swing 1.1.1 Beta 1), JMenuItem, JMenu,
JCheckBoxMenuItem, JRadioButtonMenuItem, JTabbedPane, and
JToolTip (whose HTML support was added in Swing 1.1.1 Beta 2) --
but not yet JCheckBox or JRadioButton.
If the text property of an HTML-supporting component is a string that
begins with "<html>", the rest of the string is used to create a
lightweight HTML docuemnt and the text is rendered by the full
Swing styled-text engine. For example, the following code creates
a JLabel that displays multiple lines of text in different fonts
and colors:
String htmlText =
"<html>A JLabel with <i>various <font color=blue>text styles<br>" +
"And a new line!</font></i>";
JLabel myLabel = new JLabel(htmlText);
Look for more information about this feature in The Java Tutorial, in
how-to pages such as the label page:
http://java.sun.com/docs/books/tutorial/uiswing/components/label.html
>
> Also, can JTooltip do it as well?
Apparently yes :-)
>
>
> --
> Thanks for any help given
>
> Lois
Technical Details
Message-ID:
<37CC51AE.BF0F0A96@cassiopeia.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7qg0re$8316@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,87e3da07743645f8 X-Google-Attributes: gid111d45,public From: Holger Stratmann <hs@cassiopeia.de> Subject: Re: Multiline text on JButtons? Date: 1999/09/01 Message-ID: <37CC51AE.BF0F0A96@cassiopeia.de> X-Deja-AN: 519482776 Content-Transfer-Encoding: 7bit References: <7qg0re$8316@forums.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: Holger@cheerful.com Newsgroups: borland.public.jbuilder.java.swing