GUI组件——TextArea
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package x_09;
import java.awt.*;
import javax.swing.*;
/**
*
* @author Administrator
*/
public class TextArea extends JFrame {
public TextArea(){
super("文本区域—TextArea");
setSize(500,350);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
FlowLayout flo=new FlowLayout();
setLayout(flo);
JTextArea comments=new JTextArea();
add(comments);
JTextArea desire=new JTextArea("I should have been love in you so much!\n",10,25);
add(desire);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
TextArea sal=new TextArea();
}
}
运行截图: