class GridLayoutTest extends Frame {public GridLayoutTest(String str) {super(str); Button btn[] = new Button[6]; setLayout(new GridLayout(3,2));for (int i = 0; i < 6; i++) {btn[i] = new Button((i + 1) + "번 버튼");add(btn[i]);}setSize(200, 200);setVisible(true); }} public class GridLayoutMain { public static void main(String[] args) {// TODO Auto-generated method stubnew GridLayoutTest("Grid Layout..
class BorderLayoutTest extends Frame {public BorderLayoutTest(String str) {super(str); setLayout(new BorderLayout());add("North", new Button("북쪽"));add("South", new Button("남쪽"));add("West", new Button("서쪽"));add("East", new Button("동쪽"));add("Center", new Button("중앙")); setSize(200, 200);setVisible(true);}} public class BorderLayoutMain {public static void main(String[] args) {// TODO Auto-gene..
class FlowLayoutTest extends Frame {public FlowLayoutTest(String str) {super(str); FlowLayout fl = new FlowLayout();Button btn[] = new Button[10]; setLayout(fl);for (int i = 0; i < 10; i++) {btn[i] = new Button((i + 1) + "번 버튼");add(btn[i]);}setBounds(100, 100, 200, 200);setVisible(true);}} public class FlowLayoutMain { public static void main(String[] args) {// TODO Auto-generated method stubne..
class MenuTest extends Frame {public MenuTest(String str) {super(str); MenuBar mb = new MenuBar(); //메뉴바 생성Menu file = new Menu("File"); //메뉴 객체 생성MenuItem file_new = new MenuItem("new item");MenuItem file_open = new MenuItem("open");MenuItem file_delete = new MenuItem("delete");MenuItem file_save = new MenuItem("save");//세부 메뉴 생성 file.add(file_new);file.add(file_open);file.add(file_delete);file..
class TextAreaText extends Frame {public TextAreaText(String str) {super(str); Panel p = new Panel();//TextArea txt1 = new TextArea(10,30); //행열 크기 10x30TextArea txt1 = new TextArea("good",15,35); // +@ 초기 문자 셋팅TextField txt2 = new TextField("Hello Java", 20); //txt1.setText("Java World");txt1.setBackground(Color.DARK_GRAY); //영역 배경색 지정txt1.setFont(new Font("굴림체",Font.BOLD,10)); //폰트 지정txt1.setF..
class TextFieldTest extends Frame {public TextFieldTest(String str) {super(str);Panel p = new Panel();Label lb01 = new Label("ID");Label lb02 = new Label("PASSWORD");// 두 개의 레이블(텍스트) 생성 TextField txt01 = new TextField(20);TextField txt02 = new TextField(20);// 텍스트필드 생성, 글자수는 20 txt02.setEchoChar('*'); // txt02, 즉 패스워드의 글자를 *로 치환p.add(lb01);p.add(txt01);p.add(lb02);p.add(txt02);add(p);setSize(300..
class ListTest extends Frame{public ListTest(String str){super(str);Panel p = new Panel();List list = new List();//List list = new List(2);//List list = new List(5, true); //숫자만큼의 항목을 보여주고 멀티 선택이 가능list.add("수곡동");list.add("도곡동");list.add("둔산동");list.add("사직동");list.add("개신동");p.add(list);add(p);setSize(300,300);setVisible(true);}} public class ListMain { public static void main(String[] args) {..
//Label을 상속받는 깜박임레이블 클래스를 정의한다.class FlickeringLabel extends Label implements Runnable {public FlickeringLabel(String str) {super(str); // 스레드 생성 및 시작Thread thread = new Thread(this);thread.start();} @Overridepublic void run() {// TODO Auto-generated method stubint n = 0;while (true) {if (n == 0)setBackground(Color.YELLOW);elsesetBackground(Color.GREEN);if (n == 0)n = 1;elsen = 0;try {Thread.sle..