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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
JLabel and text
jonas okwara
Ranch Hand
Posts: 58
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How can I add three rows of text to a JLabel();. what I have done so far is to add the each row of text to a JLabel object,add the label objects to a pane with a "GridLayout(0,1)". I tried a BoxLayout but the gaps between the rows was much .
Please is there a better way of doing this.
thx
newbie
jones
Michael Dunn
Ranch Hand
Posts: 4632
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.awt.*; import javax.swing.*; class Testing extends JFrame { public Testing() { setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(200,100); setLocation(400,300); getContentPane().add(new JLabel("<html>one<br>two<br>three</html>")); } public static void main(String[] args){new Testing().setVisible(true);} }
jonas okwara
Ranch Hand
Posts: 58
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I am using the setText() method of the JLabel object. Can your solution factor into this.
Dirk Schreckmann
Sheriff
Posts: 7023
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Moving this to the Swing / JFC / AWT forum...
[
How To Ask Good Questions
] [
JavaRanch FAQ Wiki
] [
JavaRanch Radio
]
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Transparent color for the panel !
JTable
Is it possible to display One JLabel Text in two lines
Code to generate a Grid Test GUI
Problem with BoxLayout and JTextField
More...