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
Win a copy of
Communication Patterns: A Guide for Developers and Architects
this week in the
Design and Architecture
forum!
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
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Swing / AWT / SWT
2 lines of text for a label?
Dave Johnson
Ranch Hand
Posts: 111
posted 20 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 20 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 20 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 20 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 20 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 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Sorry Joe I misunderstood you, many thanks for your help.
Whatever. Here's a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
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?
We need your help - Coderanch server fundraiser
More...