make Wrappable Label as JTextArea - Java Swing

Java examples for Swing:JTextArea

Description

make Wrappable Label as JTextArea

Demo Code


//package com.java2s;
import java.awt.Font;
import javax.swing.JTextArea;

public class Main {
    public static JTextArea makeWrappableLabel(String labelText) {
        JTextArea wrappedLabel = new JTextArea(labelText);
        wrappedLabel.setLineWrap(true);//from  w w w . j  av a2s.  c  om
        wrappedLabel.setWrapStyleWord(true);
        wrappedLabel.setFont(new Font("Tahoma", Font.PLAIN, 11));
        wrappedLabel.setEditable(false);
        wrappedLabel.setBackground(null);
        return wrappedLabel;
    }
}

Related Tutorials