Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Ron McLeod
Jeanne Boyarsky
Paul Clapham
Sheriffs:
Liutauras Vilda
Henry Wong
Devaka Cooray
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Al Hobbs
Carey Brown
Bartenders:
Piet Souris
Mikalai Zaikin
Himai Minh
Forum:
Swing / AWT / SWT
2 lines of text for a label?
Dave Johnson
Ranch Hand
Posts: 111
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I wanted to know if it is possible for 1 Label or JLabel to print more than 1 line of text.
For example:
Dave Johnson
would become;
Dave
Johnson
I know that I could just have 2 Labels but that wouldn't work for what I am trying to do.
Any ideas?
Joe Ess
Bartender
Posts: 9626
16
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
A quick and dirty solution is to use HTML for the label text:
JLabel aLabel = new JLabel("<html><b>Two<br>lines</html>");
[
How To Ask Questions On JavaRanch
]
Dave Johnson
Ranch Hand
Posts: 111
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No good Joe, the program is not an
applet
. Good idea though!
Jose Botella
Ranch Hand
Posts: 2120
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The program does not need to be an applet.
SCJP2. Please Indent your code using UBB Code
Joe Ess
Bartender
Posts: 9626
16
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can use HTML to format the text on lots of Swing components, applet or no. Check the
Java
Tutorial.
[
How To Ask Questions On JavaRanch
]
Dave Johnson
Ranch Hand
Posts: 111
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Sorry Joe I misunderstood you, many thanks for your help.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
unable to do validation for select in struts2
sdk1.4
A few GUI questions
moverover on label
How to use, struts 1-- struts-config.xml and struts 2 -- struts.xml together?
More...