Solved

wordwrap for Label text ?

Posted on 2001-08-08
5
369 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

744 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

10 Experts available now in Live!

Get 1:1 Help Now