Solved

wordwrap for Label text ?

Posted on 2001-08-08
5
372 Views
Last Modified: 2010-10-05
hello,
here is a simple one.
i would like to know if its possible to wordwrap the text in Label. (not JLabel).
if so, how???

thanks
Ori
0
Comment
Question by:o_helman
5 Comments
 

Expert Comment

by:raga
ID: 6363619
No, there is no option for wordwrap in Label.
But,try setting the size of the Label and give the label string more than the size. Then it may help. Let me know.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6363622
As far as I know this is not possible. If you need multi-line Label, define a subclass of Panel and set its LayoutManager to new GridLayout(0, 1) and add a Label for each line.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6363624
No, raga, I already tried this.
0
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 6363631
Hi,

    I think there is no direct method available for that.
Anyhow, try this link

http://java.cs.vt.edu/dev/kfc/jp.kyasu.editor.TextEditor.html

:-)

Mohan
0
 
LVL 26

Accepted Solution

by:
ksivananth earned 50 total points
ID: 6363718
Hi,
 
   instead of using the Label, use the TextArea and set the background and foreground property by getting it from the container.

 for eg,

  JPanel pnl = new JPanel() ;
  JTextArea ta = new JtextArea() ;

  ta.setBackground( pnl.getBackground() ) ;

 like this set the foregroung property too. So ti will look like a label.Or use the drawString() method of the graphics class. I have implemented this ideas in my app.

thank u
siva

 
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Eclipse IDE - Cannot copy/paste from console output 8 126
Where to store the queries for modification of table 4 54
Apps blocked by Java 9 60
javap bin 2 26
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now