Java examples for Swing:JTextArea
Configures a JTextArea to display as if it were a label.
//package com.java2s; import java.awt.Font; import javax.swing.JTextArea; import javax.swing.UIManager; public class Main { /**//from w w w . j av a2 s.c om * Configures a text area to display as if it were a label. This can be useful if you know how many columns * you want a label to be. * @param textArea The text area to configure as a JLabel. */ public static void configureAsLabel(JTextArea textArea) { textArea.setOpaque(false); Font textFont = UIManager.getFont("Label.font"); textArea.setFont(textFont); textArea.setBorder(null); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); } }