package speechrecorder;
import java.awt.Container;
import java.awt.FlowLayout;

import javax.swing.JLabel;
import javax.swing.JTextArea;

//by sindisil  see this post: http://www.gamedev.net/community/forums/topic.asp?topic_id=383461
public  class MultiLineLabel extends JTextArea {

 public MultiLineLabel(Container parent, String text,
                        int maxWidth, boolean labelFont) {
     super();
     JLabel lbl = new JLabel();
     setFocusable(false);
     setEditable(false);
     setBackground(lbl.getBackground());
     setLineWrap(true);
     setWrapStyleWord(true);
     if (labelFont) {
         setFont(lbl.getFont());
     }
     setHighlighter(null);
     if (maxWidth > 0) {
         //setColumns(Math.min(maxWidth, text.length()));
         setColumns(Math.min(maxWidth, 100));
     }
     append((text == null || text.length() == 0) ? " " : text);
 }

 public MultiLineLabel(Container parent, String text) {
     this(parent, text, 0, true);
 }

 public MultiLineLabel(Container parent, String text, boolean labelFont) {
     this(parent, text, 0, labelFont);
 }

 public MultiLineLabel(Container parent, String text, int maxWidth) {
     this(parent, text, maxWidth, true);
 }
}
