⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mymenubar.java

📁 JAVA CLONE 用于CLASS范式的CLONE
💻 JAVA
字号:
package frame;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;


public class MyMenuBar extends JMenuBar{
	ManagerSystem jfram;
	public MyMenuBar(ManagerSystem myjfram)
	{
		jfram=myjfram;
		this.setMargin(new Insets(1,5,1,5));
		JMenu mbuildIntroductionMenu = buildIntroductionMenu();//
		JMenu mbuildClassMenu=buildClassMenu();
		JMenu mbuildStudentMenu=buildStudentMenu();
		JMenu mbuildCourseMenu=buildCourseMenu();
		JMenu mbuildStudentAndCourseMenu=buildStudentAndCourseMenu();
		this.add(mbuildIntroductionMenu); //
		this.add(mbuildClassMenu);
		this.add(mbuildStudentMenu);
		this.add(mbuildCourseMenu);
		this.add(mbuildStudentAndCourseMenu);
	}
	public JMenuBar bulidMenuBar()
	{
		JMenuBar MBar = new JMenuBar();//
		  MBar.setMargin(new Insets(1,5,1,5));
		  
		  JMenu mbuildIntroductionMenu = buildIntroductionMenu();//
		  JMenu mbuildClassMenu=buildClassMenu();
		  JMenu mbuildStudentMenu=buildStudentMenu();
		  JMenu mbuildCourseMenu=buildCourseMenu();
		  JMenu mbuildStudentAndCourseMenu=buildStudentAndCourseMenu();
		  
		  MBar.add(mbuildIntroductionMenu); //
		  MBar.add(mbuildClassMenu);
		  MBar.add(mbuildStudentMenu);
		  MBar.add(mbuildCourseMenu);
		  MBar.add(mbuildStudentAndCourseMenu);
		  return MBar;
	}
	public JMenu buildIntroductionMenu() {
	  	
		  JMenu thefile = new JMenu("system info ");
		  JMenuItem introduction=new JMenuItem("author info ");
		  JMenuItem exit=new JMenuItem("exit");
		  
		  exit.addActionListener(new ActionListener() {
        	     public void actionPerformed(ActionEvent e) {
   	               System.exit(0);
      	         }});
		  introduction.addActionListener(new ActionListener() 
			  {
         	     public void actionPerformed(ActionEvent e) 
         	     {
         	    	actionEvent_introduction();
        	     }
         	  }
		  );
		  
	      thefile.addSeparator();
	      thefile.add(introduction);
	      thefile.add(exit);
		  return thefile;
		}//end of buildFileMenu()

	public JMenu buildStudentMenu() {
	  	
		  JMenu theStudent = new JMenu("student manager");
		  JMenuItem allStudent=new JMenuItem("all student info ");
		  JMenuItem addnewstudent=new JMenuItem("add new student");
		  allStudent.addActionListener(new ActionListener() 
		  {
     	     public void actionPerformed(ActionEvent e) 
     	     {         		    
     	    	actionEvent_allStudent();
    	     }
     	  }
		  );
		  addnewstudent.addActionListener(new ActionListener() 
		  {
     	     public void actionPerformed(ActionEvent e) 
     	     {         		    
     	    	actionEvent_addnewstudent();
    	     }
     	  }
		  );
		  theStudent.add(allStudent);
		  theStudent.add(addnewstudent);
		  theStudent.addSeparator();
		  return theStudent;
		}//end of buildFileMenu()
	public JMenu buildCourseMenu() {
	  	
		  JMenu theCourse = new JMenu("course manage");
		  JMenuItem allcourse=new JMenuItem("all course info");
		  JMenuItem addnewcourse=new JMenuItem("add new course");
		  allcourse.addActionListener(new ActionListener() {
     	     public void actionPerformed(ActionEvent e) {
     	    	 	actionEvent_allcourse();
    	         }});
		  
		  addnewcourse.addActionListener(new ActionListener() {
	     	     public void actionPerformed(ActionEvent e) {
	     	    	actionEvent_addnewcourse();
	    	         }});
		  theCourse.add(allcourse);
		  theCourse.add(addnewcourse);
		  theCourse.addSeparator();
		  return theCourse;
		}//end of buildFileMenu()
	
	public JMenu buildClassMenu() {
	  	
		  JMenu theclass = new JMenu("class manage");
		  JMenuItem allclass=new JMenuItem("all class info");
		  JMenuItem addnewclass=new JMenuItem("add new class");
		  allclass.addActionListener(new ActionListener() {
			  public void actionPerformed(ActionEvent e) {
				  actionEvent_allclass();
  	         		}});
		  addnewclass.addActionListener(new ActionListener() {
		   	     public void actionPerformed(ActionEvent e) {
		   	    	actionEvent_addnewclass();
		  	         }});
		  theclass.add(allclass);
		  theclass.add(addnewclass);
		  theclass.addSeparator();
		  return theclass;
		}//end of buildFileMenu()
	public JMenu buildStudentAndCourseMenu() {
	  	
		  JMenu thestudentandcourse = new JMenu("student and course relation manage");
		  JMenuItem allinfo=new JMenuItem("all info");
		  JMenuItem addnewrelation=new JMenuItem("new relation");
		  allinfo.addActionListener(new ActionListener() {
   	     public void actionPerformed(ActionEvent e) {
   	    	actionEvent_allStudentAndCourserelation();
  	         }});
		  allinfo.addActionListener(new ActionListener() {
		   	     public void actionPerformed(ActionEvent e) {
		   	    	actionEvent_addnewStudentAndCourserelation();
		  	         }});
				  
		  thestudentandcourse.add(allinfo);
		  thestudentandcourse.add(addnewrelation);
		  thestudentandcourse.addSeparator();
		  return thestudentandcourse;
		}//end of buildFileMenu()
	public void actionEvent_introduction()
	{			
	}
	public void actionEvent_back()
	{
	}
	public void actionEvent_allStudent()
	{

	}
	public void actionEvent_addnewstudent()
	{
		new AddNewStudent(jfram);
	}
	public void actionEvent_allcourse()
	{

	}
	public void actionEvent_addnewcourse()
	{

	}
	public void actionEvent_allclass()
	{
		
	}
	public void actionEvent_addnewclass()
	{
		new AddNewClass(jfram);
	}
	public void actionEvent_allStudentAndCourserelation()
	{

	}
	public void actionEvent_addnewStudentAndCourserelation()
	{

	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -