본문 바로가기
Studynote/Computer Science 12

14.11.17 13장 awt와 애플릿

by e.sunie 2018. 11. 5.


moon_and_james-61

졸려..ㄷㅅㄷ

 

 

 

 

2.9 Scrollbar

 

2.11 Panel

frame안에는 container가 있다.그 안에 Panel이 있다

(Frame > Cotainer > Panel)

 

빈 평면 공간만 가지고 있는 종속적인 컨테이너

Panel안에 Panel을 넣을 수 있다

 

 

Container ct = f.getContentPane();

 

f.add();

ct.add();

 

2.12 ScrollerPane

하나의 컴포넌트만 포함할 수 있는 종속적인 컨테이너

더 큰용량을 포함가능 하기에 사용

 

2.13 Dialog

 

Frame과 같이 독립적인 컨테이너

모델& 모델리스

 

3.14 FileDoalog

 package chapter13;
import java.awt.*;
import javax.swing.*;
public class FileDialogTest {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  JFrame f = new JFrame("FIle Dialog Test");
  FileDialog fileOpen = new FileDialog(f,"File Open",FileDialog.LOAD);
  fileOpen.setDirectory("c:\\");
  fileOpen.setVisible(true);
  System.out.println(fileOpen.getDirectory()+fileOpen.getFile());
  f.setSize(300,200);
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.setVisible(true);

 }

}
package chapter13;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DialogTest {

 public static void main(String[] args) {
  
  JFrame f = new JFrame("Dialog Test");
  JDialog info = new JDialog(f,"Informateion",true);
  info.setSize(140,90);
  info.setLocation(50, 50);
  info.setLayout(new FlowLayout());
  JLabel msg = new JLabel("This is modal dia");
  JButton ok = new JButton("확인");
  ok.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) { 
    //info.dispose();
     String temp =JOptionPane.showInputDialog("Enter a number");
    }
   });
  info.add(msg);
  info.add(ok);
  /*이후 코드 더있음 */
  
 }

}

'Studynote > Computer Science 12' 카테고리의 다른 글

11.25.Tue ch13-5. 이벤트처리  (0) 2018.11.05
14.11.18.화요일 13장 폰트~  (0) 2018.11.05
14.11.11.Tue  (0) 2018.11.05
14.11.10.mon  (0) 2018.11.05
chapter 11 Map  (0) 2018.11.05

댓글