root/Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/MultiLineLabel.java

Revision 2907, 1.2 KB (checked in by kmaclean, 12 months ago)

snapshot - Bulgarian language addition

Line 
1package speechrecorder;
2import java.awt.Container;
3//import java.awt.FlowLayout;
4
5import javax.swing.JLabel;
6import javax.swing.JTextArea;
7
8//by sindisil  see this post: http://www.gamedev.net/community/forums/topic.asp?topic_id=383461
9public  class MultiLineLabel extends JTextArea {
10
11 public MultiLineLabel(Container parent, String text,
12                        int maxWidth, boolean labelFont) {
13     super();
14     JLabel lbl = new JLabel();
15     setFocusable(false);
16     setEditable(false);
17     setBackground(lbl.getBackground());
18     setLineWrap(true);
19     setWrapStyleWord(true);
20     if (labelFont) {
21         setFont(lbl.getFont());
22     }
23     setHighlighter(null);
24     if (maxWidth > 0) {
25         //setColumns(Math.min(maxWidth, text.length()));
26         setColumns(Math.min(maxWidth, 100));
27     }
28     append((text == null || text.length() == 0) ? " " : text);
29 }
30
31 public MultiLineLabel(Container parent, String text) {
32     this(parent, text, 0, true);
33 }
34
35 public MultiLineLabel(Container parent, String text, boolean labelFont) {
36     this(parent, text, 0, labelFont);
37 }
38
39 public MultiLineLabel(Container parent, String text, int maxWidth) {
40     this(parent, text, maxWidth, true);
41 }
42}
Note: See TracBrowser for help on using the browser.