This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JLabel/Font specification/Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JLabel/Font specification/Urgent" Watch "JLabel/Font specification/Urgent" New topic

JLabel/Font specification/Urgent

Sonara Rahul
Ranch Hand

Joined: Jul 07, 2001
Posts: 60
Hello Friends,
I have a problem in specifying font for all my labels.
For eg:
I have a label "qwert yuio pasdfgf hjkkl zxcvcxbx" .
I need font arial 12pts.
I specify it in html tag as follows:
JLabel jLab=new JLabel("<html>

qwert yuio pasdfgf hjkkl zxcvcxbx</html>");
All the attributes described is reflected in my label,but the line-height:18px is not reflected.
The label is placed in TextPane or just in panel.
qwert yuio |
pasdfgf hjkkl|
zxcvcxbx |
My need is to reduce the spacing b/w the lines,so i have mentioned it as "line-height:18px ".
But this is not reflected in any way in java. So pl.. help me in reducing the space b/w the lines that could be specified only within html tag.
Excepting u'r replies.
with regards,

Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
try to specify an instance of Font and set this Font for your label. (I dont know, if you can specify the line height, though).
are you coding under Linux? html in java is not rendered nicely under linux.
I agree. Here's the link:
subject: JLabel/Font specification/Urgent
Similar Threads
CSS not getting applied
CSS not getting applied
Font type supported by java
Multi Line JLabel
Html tag