[실행 결과]
[소스]
/* Text3.java */
import java.awt.*;
public class Text3 extends Frame{
public Text3(String str){
super(str);
setLayout(new FlowLayout());
TextArea txt1 = new TextArea("간단한 메모를 입력...", 10, 20);//TextArea와
TextField txt2 = new TextField(20); //TextField 객체를 생성합니다.
txt1.setBackground(Color.yellow);//txt1의 배경색상을 노란색으로 지정합니다.
txt1.setForeground(Color.blue); //txt1의 글자색상을 파란색으로 지정합니다.
txt2.setForeground(Color.red); //txt2의 글자색상을 빨간색으로 지정합니다.
txt2.setEchoChar('#'); //txt2의 문자 출력을 '#'으로 지정합니다.
add(txt1); add(txt2);
setSize(200,250);
setVisible(true);
}
public static void main(String[] args) {
new Text3("Text 예제");
}
}