A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
Swing / AWT / SWT
Author
can get label on second line
Raja Mothi
Greenhorn
Joined: Nov 18, 2004
Posts: 2
posted
Nov 18, 2004 18:38:00
0
When I insert a label on frame I can insert on only one line how to get on next line is there any escape sequence like???
Like I want
My name is jay.
I am 21 years old
but I am getting
My name is jay. I am 21 years old
Is there any way by which I can get label on second line
Regards
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
Nov 18, 2004 19:03:00
0
If you mean
JLabel
import javax.swing.*; import java.awt.*; class Testing extends JFrame { public Testing() { setLocation(400,300); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel jp = new JPanel(); jp.add(new JLabel("<html>My name is jay.<br>I am 21 years old</html>")); getContentPane().add(jp); pack(); } public static void main(String args[]){new Testing().setVisible(true);} }
Raja Mothi
Greenhorn
Joined: Nov 18, 2004
Posts: 2
posted
Nov 18, 2004 19:09:00
0
Michael
You said this is in case of label
So what about othe components?
Can you please put light on this too
Regards
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
Nov 18, 2004 20:00:00
0
>So what about othe components?
Such as?
(the best way to find out is to experiment)
I agree. Here's the link:
http://zeroturnaround.com/jrebel
subject: can get label on second line
Similar Threads
s:iterator, can you save values other control tags like s:label? POJO
problem in GridBagLayout
String Tokenizer Question
MySql array (workarounds?)
Why does cons remain equal to null?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter