텍스트필드의 문자열을 텍스트 에어리어로 옮기는데요...


[ 다음 글들 ] [ 이어서 글올리기(답하기) ] [ 자바 묻고 답하기 ]

글쓴이 :박현아 1999년 7월 05일 20:16:55

TextField의 문자열을 밑의 TextArea로 나타내게 하려고 하는데요. 왠지 getText()함수를 호출하고 나면 그밑의 라인들이
실행되질 않네요. 뭐가 문제일까요 ?
소스를 고쳐주시겠습니까 ?


import java.awt.*;
import java.awt.event.*;


class Test extends Frame implements TextListener{
TextField textfield;
TextArea textarea;

Test() {

setLayout(new BorderLayout());
TextField textfield = new TextField("hi");
TextArea textarea = new TextArea();
add(textfield, "North");
add(textarea, "Center");
textfield.addTextListener(this);

setSize(300,300);
doLayout();
setVisible(true);
}

public void textValueChanged(TextEvent e) {

String string = new String();
string = textfield.getText();
textarea.append(string);
}

public static void main(String args[]) {
new Test();
}
}


다음 글들:



이어서 글올리기(답하기)

이름:
E-Mail:
제목:
내용:
HTML 태그 포함 여부: HTML 문서일 경우 체크
관련 URL(선택):
URL 제목(선택):
관련 이미지 URL:


[ 다음 글들 ] [ 이어서 글올리기(답하기) ] [ 자바 묻고 답하기 ]