자바8주차 두번째 일기

죄송합니다 교수님!!!
제가 깜빡하고 일기를 한번 못썼습니다. ㅠㅠ
내일 배울 내용 예습합니다 교수님!!


자바에서 윈도우를 만드는 방법은 AWT와 SWING이 있다.
AWT는 os에 따라 결과가 다르다
하지만 스윙은 Look&Feel 보고느끼는 거에 대해서 설정을 할 수 있다.

컨테이너
AWT와 비슷하나
JFrame, JDialog, JWindow, JApplet, JInternalFrame은 직접 add()메서드를 호출해 컴포넌트를 추가할수 없다.

import javax.swing.*;
import java.awt.*;

public class SwingExam
{
 public static void main (String args[]){
  JFrame j = new JFrame("Swing예제"); //J프레임 만들기
  j.setSize (200,200);
  Container contentPane = j.getContentPane();  //컨테이너 가져오기
  JPanel pane = new JPanel();
  pane.setLayout(new GridLayout(3,2));  //GridLayout으로
  pane.add(new JTextField(10));
  pane.add(new JPasswordField(10));
  pane.add(new JRadioButton("Radio"));
  pane.add(new JButton("Button"));
  String []data = {"one", "two", "three", "four"};
  pane.add(new JList(data));
  pane.add(new JCheckBox("Checkbox"));
  contentPane.add(pane,"Center");  //결과를 contentPane에 저장
  contentPane.add(new JButton("Button2"),"South");
  j.setVisible(true);
 }
}

우선 스윙에 대해서 조금 공부해 봣는데 AWT랑 많이 비슷한대 더 어려워 진듯 하네여 ㅠㅠ
지금 계속 공부하고 있겠습니다.
그럼 교수님 내일 뵙겠습니다.

by 파브레가스 | 2008/10/28 21:29 | 실험프로젝트2학기 | 트랙백 | 덧글(1)

트랙백 주소 : http://kim6351.egloos.com/tb/1022104
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Commented by 김교수 at 2008/11/07 14:27
아니 뭐...더 어렵다고 할 것 까지야....--;;;

:         :

:

비공개 덧글

◀ 이전 페이지 다음 페이지 ▶