import java.awt.event.*;

import javax.swing.*;

class MenuActionListener implements ActionListener
{
         @Override
         public void actionPerformed(ActionEvent e)
        {
                String cmd = e.getActionCommand();
                System. out.println(cmd );
        }
}

public class Swing03 extends JFrame
{
        Swing03()
        {
               setTitle( "학사관리 시스템" );
                setDefaultCloseOperation( JFrame. EXIT_ON_CLOSE);
               
                JMenuBar bar = new JMenuBar();
               
                JMenu M_student = new JMenu( "학생관리" ); // 학생관리 메뉴    
                bar.add( M_student); // 학생관리 메뉴 추가
                JMenu M_book = new JMenu( "도서관리" ); // 도서관리 메뉴    
                bar.add( M_book); // 도서관리 메뉴 추가
               
                JMenuItem MI_list = new JMenuItem( "학생목록" ); // 학생목록 세부메뉴
                M_student.add( MI_list); // 학생목록 세부메뉴 추가
                JMenuItem MI_insert = new JMenuItem("학생등록" ); // 학생등록 세부메뉴
                M_student.add( MI_insert); // 학생등록 세부메뉴 추가
                JMenuItem MI_update = new JMenuItem("학생수정" ); // 학생수정 세부메뉴
                M_student.add( MI_update); // 학생수정 세부메뉴 추가
                M_student.addSeparator(); // 구분선 추가
                JMenuItem MI_status = new JMenuItem("학적변경" ); // 학적변경 세부메뉴
                M_student.add( MI_status); // 학적변경 세부메뉴 추가
               
                // 메뉴 아이템 이벤트 처리
                MI_list.addActionListener( new MenuActionListener());
               
               setJMenuBar( bar);
               setSize(800, 600);
               setVisible( true);
        }
        
         public static void main(String [] args)
        {
                new Swing03();
        }
}