• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 399
  • Last Modified:

wordwrap for Label text ?

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
o_helman
Asked:
o_helman
1 Solution
 
ragaCommented:
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
 
dnoelppCommented:
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
 
dnoelppCommented:
No, raga, I already tried this.
0
 
mohan_sekarCommented:
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
 
ksivananthCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now