?
Solved

wordwrap for Label text ?

Posted on 2001-08-08
5
Medium Priority
?
385 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

764 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