보이기/숨기기 가능합니다^^
분류 전체보기 (117)
임베디드 시스템 (3)
프로그래밍 (87)
웹프로그래밍 (22)
출사 (0)
가지고싶은물건! (4)
게시판 (1)
비밀글&사진 (0)
보이기/숨기기 가능합니다^^
'TextField'에 해당되는 글 2건
[두걸음] TextArea와 TextField를 사용해 다음 그림처럼 출력되는 프로그램을 작성해보세요. 단, TextArea의 바탕색은 노란색, 글자색은 파란색입니다. 그리고 TextField는 문자를 입력할 때 '#' 문자가 출력되도록 하고, 글자색은 빨간색으로 합니다.
웹프로그래밍/JAVA | 2008. 10. 4. 07:03

[실행 결과]

사용자 삽입 이미지

[소스]

/* 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 예제");
 }
}

:
위로
[한걸음] TextField를 사용하는 프로그램입니다.
웹프로그래밍/JAVA | 2008. 10. 4. 06:47

[소스]
/* Text1.java */

import java.awt.*;

public class Text1 extends Frame{
 public Text1(String str){
  super(str);
  setLayout(new FlowLayout());
  Label id = new Label("아이디 입력:");
  Label pwss = new Label("비밀번호 입력:");
  TextField idtxt = new TextField("ID", 20); //"ID"는  txt1 컴포넌트 위에
             //출력될 초기 문자열입니다.
             //20은 20개의 문자를 입력할
             //수 있도록 TextField의
             //크기를 지정합니다.

  TextField pwsstxt = new TextField(20);
  pwsstxt.setEchoChar('*'); //비밀번호를 입력하면 *로 표시됩니다.
  add(id); add(idtxt);
  add(pwss); add(pwsstxt);
 
  setSize(200, 200);
  setVisible(true);  
 }
 
 public static void main(String[] args) {
  new Text1("TextField 예제");
 }
}

[실행 결과]

사용자 삽입 이미지

:
위로
이전 페이지
[1]
다음 페이지
보이기/숨기기 가능합니다^^
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
보이기/숨기기 가능합니다^^
보이기/숨기기 가능합니다^^
보이기/숨기기 가능합니다^^
RSSFeed