«   2025/01   »
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 31
Tags
more
Archives
Today
Total
관리 메뉴

올해는 머신러닝이다.

메모장 제 1일차(2시간작업) 본문

자바/메모장

메모장 제 1일차(2시간작업)

행복한 수지아빠 2010. 10. 14. 15:31

//메모장 만들자

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

public class NotePadExam extends JFrame
{
 JFrame jf;
 JMenuBar jmb;
 JMenu jm;
 JMenuItem jmt;
 JLabel jlb1;
 JTextArea jta;
 
 public NotePadExam()
 {
  super("메모장");
  try
  {

  setLayout(new FlowLayout());
  jmb = new JMenuBar();
  /*//////////////
  파일메뉴추가
  /*//////////////
  jm = new JMenu("파일");
  
  jm=createMenuItem(jm,"새로만들기");
  jm=createMenuItem(jm,"열기");
  jm=createMenuItem(jm,"저장");
  jm=createMenuItem(jm,"다른이름으로 저장");
  jm=createMenuItem(jm,"끝내기");
  
  jta = new JTextArea(200,200);
  
  //메뉴바추가
  jmb.add(jm);
  /*//////////////
  파일메뉴추가
  /*//////////////

  add(jmb);
  
  //jmb.setSize(50,200);
  //텍스트창추가
  add(jta);
   
  }
  catch (Exception ex)
  {
   System.out.println(ex);
  }
 }
 public JMenu createMenuItem(JMenu jmi,String name2)
 {
  //System.out.println("111111111");
  JMenuItem jmui = new JMenuItem(name2);  
  jmi.add(jmui);
  return jmi;
 }
 public static void main(String[] args)
 {
  NotePadExam npe = new NotePadExam();
  npe.setSize(300,300);
  npe.setVisible(true);

  //System.out.println("Hello World!");
 }
}