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

📄 paper.java

📁 报刊管理系统java做的
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            {
                
            }
}

//============================================================使用说明
public void shuoming()
{
		final JFrame ggg = new JFrame("使用说明");
    	    Container contentPane = ggg.getContentPane();
    	    contentPane.setLayout(new FlowLayout());	 
		     JPanel p5 = new JPanel();
    	     p5.setLayout(new FlowLayout());
             String me="大家好,欢迎使用报刊管理";	
             String me2="本系统是对数据库的操作,如果失败请检查数据源是否配对 " ;            
		      JLabel lab=new JLabel(me);
		      JLabel lab2=new JLabel(me2);
		         contentPane.add(p5);
		         contentPane.add(lab);  
		         contentPane.add(lab2);  
              ggg.pack();
              ggg.setSize(350,100);
              ggg.setLocation(300,250);              ;                      
    	      ggg.show();        
    	      ggg.addWindowListener(new WindowAdapter() {            
    		public void windowClosing(WindowEvent e) {                    
    			ggg.dispose();           
    		}        
    	});    
}



//=================================================================关于作者
public void writer()
{
	
		     final JFrame gg = new JFrame("作者信息");
	    	  Container contentPane = gg.getContentPane();
	    	   contentPane.setLayout(new FlowLayout());		   
			    JPanel p5 = new JPanel();
	    	     p5.setLayout(new FlowLayout());
	             String me="05软件测试3班,郭顺旭";	
	             String me2="E-MAIL:guosxus@163.com,QQ;373287329"	;
             
		      JLabel lab=new JLabel(me);
		      JLabel lab2=new JLabel(me2);
		        contentPane.add(p5);		       
		        contentPane.add(lab);  
		        contentPane.add(lab2);  
              gg.pack();
              gg.setSize(300,100);
              gg.setLocation(300,200);
              gg.setVisible(true);                      
    	      gg.show();        
    	     gg.addWindowListener(new WindowAdapter() 
    	      {            
    		     public void windowClosing(WindowEvent e)
    		       {                    
    			     gg.dispose();           
    		        }        
    	         });    

}

///////////////////////////// //断开数据库连接 

public void shutDown() 
{ 
try { 

connection.close(); 
} 
catch ( SQLException sqlex ) { 
System.err.println( "Unable to disconnect" ); 
sqlex.printStackTrace(); 
} 
}
///////////////////////////////

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$--class MyTU
class MyTU extends JPanel implements ActionListener
{
	    
public MyTU() 
	{            
		     this.setBackground(Color.green); //背景色  
		    
		     addMenu();//加入菜单
	    	 //addComponents();加入按钮
	    	    
	     
	   try { //循环播放声音
	   	       InputStream in = new FileInputStream("game.wav");
             AudioStream  as = new AudioStream(in);// Create AudioData source
               AudioData data = as.getData();
                  cas = new ContinuousAudioDataStream (data);
                  AudioPlayer.player.start(cas);// Play audio.        
                       
              
	      }catch(FileNotFoundException e)
	      {
	              System.out.print("FileNotFoundException ");
          }
           catch(IOException e)
           {
		     System.out.print("音频文件有错误,没有打开");
		   }   
	  
	}//MyTU end 
      
 //=============================================菜单栏
public void addMenu()
{
	    mb1=new JMenuBar();
    	setJMenuBar(mb1);//新建一个菜单栏
		mf1=new JMenu("登录操作");
		me1=new JMenu("场景编辑");
		mlu=new JMenu("录入功能");
		mg1=new JMenu("订阅功能");
		mfind=new JMenu("查询功能");
		msee=new JMenu("统计与预览功能");
	JMenu mwei=new JMenu("系统维护");	
		mh1=new JMenu("帮助");		
		mb1.add(mf1);//将菜单添加到菜单栏上
		mb1.add(me1);
		mb1.add(mlu);		
		mb1.add(mg1);		
	    mb1.add(mfind);
	    mb1.add(msee);
	    mb1.add(mwei);		
		mb1.add(mh1);
		
	 JMenuItem me11,me12,me13,mg11,mg12,mg13,mg14,mh11,mh12;	
		
      /////////////////会员操菜单      /////   	
		
	  JMenuItem log = new JMenuItem("登录",new ImageIcon("person.gif"));
	  JMenuItem regedit = new JMenuItem("注册",new ImageIcon("person.gif"));	      
	  JMenuItem quit = new JMenuItem("退出",new ImageIcon("Stop.gif"));
       mf1.add(log );
       mf1.add(regedit);          
       mf1.add(quit );  
        log.addActionListener(this);
        regedit.addActionListener(this);
        quit.addActionListener(this);
      /////////////////       场景编辑菜单    ////////  
       
	me11=new JMenuItem("更换背景图片",new ImageIcon("person.gif"));		
	me12=new JMenuItem("更换背景音乐",new ImageIcon("person.gif"));	
	me1.add(me11);
	me1.add(me12);	
	me11.addActionListener(this);	
    me12.addActionListener(this);
    //me13.addActionListener(this);
   ///////////////////////////////////////录入菜单
     JMenuItem person= new JMenuItem("订阅人员信息录入",new ImageIcon("person.gif"));
     JMenuItem depat= new JMenuItem("订阅部门信息录入",new ImageIcon("person.gif"));
     JMenuItem paper= new JMenuItem("报刊信息录入",new ImageIcon("person.gif")); 
     mlu.add(person);
     mlu.add(depat);
     mlu.add(paper);
      person.addActionListener(this); 
      depat.addActionListener(this);
      paper.addActionListener(this);
      //////////////////////////////订阅     
    
     JMenuItem depatment= new JMenuItem("部门订阅",new ImageIcon("person.gif"));
     JMenuItem pap= new JMenuItem("个人订阅",new ImageIcon("person.gif"));      
     mg1.add(depatment);
     mg1.add(pap);    
      pap.addActionListener(this); 
      depatment.addActionListener(this);   
      
    //////////查询菜单///////////////// 
    
    mg11= new JMenuItem("按人员查询",new ImageIcon("person.gif"));	
    mg12 = new JMenuItem("按报刊名查询",new ImageIcon("visa.gif"));
    mg13 = new JMenuItem("按部门查询",new ImageIcon("visa.gif"));
    mfind.add(mg11);
    mfind.addSeparator();
    mfind.add(mg12);  
    mfind.addSeparator();    
    mfind.add(mg13);   
      mg11.addActionListener(this);
      mg12.addActionListener(this);
      mg13.addActionListener(this); 
 /////////////////////////////////////////预览菜单     
      
      
   JMenuItem  mse1=new JMenuItem("部门订购信息预览",new ImageIcon("tplay.gif"));   
     JMenuItem  mse2=new JMenuItem("部门信息预览",new ImageIcon("tplay.gif")); 
     
     JMenuItem  mse3=new JMenuItem("已有报刊信息预览",new ImageIcon("tplay.gif")); 
      
     JMenuItem  mse4=new JMenuItem("个人订购信息预览",new ImageIcon("Stop.gif"));  
      JMenuItem  mse5=new JMenuItem("个人基本资料预览",new ImageIcon("Stop.gif"));  
      
       msee.add(mse1);
       msee.add(mse2);
       msee.addSeparator();
       msee.add(mse3);
       msee.addSeparator();
       msee.add(mse4); 
       msee.add(mse5);
      
      
      mse1.addActionListener(this);
       mse2.addActionListener(this);
        mse3.addActionListener(this);
         mse4.addActionListener(this);
          mse5.addActionListener(this);
   ///////////////////////////////////////////////////////系统维护
   
        JMenuItem    mwei1=new JMenuItem("备份数据库",new ImageIcon("Stop.gif"));
          JMenuItem    mwei2=new JMenuItem("还原数据库",new ImageIcon("Stop.gif")); 
          mwei.add(mwei1);
          mwei.add(mwei2);
          mwei1.addActionListener(this);
          mwei2.addActionListener(this);
    /////////////////////////帮助菜单
    
   mh11= new JMenuItem("使用说明",new ImageIcon("help.gif"));   
   mh12= new JMenuItem("关于作者",new ImageIcon("dd.gif"));   
    mh1.add(mh11);
    mh1.add(mh12);
    mh11.addActionListener(this);
    mh12.addActionListener(this);		
		
}//menu end 

/////////////////////////////////////////////////////////////////////菜单事件响应

 public void actionPerformed(ActionEvent e)
    {
    	if(e.getActionCommand()=="登录")
               { 
                   denglu();
               }
    	if(e.getActionCommand()=="注册")
               {
               	   regedit(); 
               }
               
         if(e.getActionCommand()=="退出")
               {
               	     shutDown();
               	    System.exit(0);
               }      
      
    	 if(e.getActionCommand()=="更换背景图片")
    	 {
    	 	       changGround();
    	 }
    	
        if(e.getActionCommand()=="更换背景音乐")
    	 {
    	    	AudioPlayer.player.stop(cas);
                AudioPlayer.player.stop(cas2);   	 	
    	 	    changMusic();
    	 }
    	 
    /////////////////////////////////////////////////////////信息录入
       if(e.getActionCommand()=="订阅人员信息录入")
    	 {
    	 	    personLuru();                                   
                                           
    	 }
    	 
    	 
    	 if(e.getActionCommand()=="订阅部门信息录入")
    	 {
    	 	    DepLuru();
    	 }
    	 	 	
    		 if(e.getActionCommand()=="报刊信息录入")
    	 {
    	          paperLuru(); 
    	 }
    	 ///////////////////////////////////////////////////////////、、、、、、、、/订阅
    	 	 if(e.getActionCommand()=="部门订阅")
    	 {           
    	          dbook();
    	 }
    	 if(e.getActionCommand()=="个人订阅")
    	 {
    	 	       pbook();
    	 }	 	 	 	
   //////////////////////////////////////////////////////、、、、、、、、、、、、、、 查询	 
    	  if(e.getActionCommand()=="按人员查询")
    	 {
    	 	      personFind();

         } 
    	  if(e.getActionCommand()=="按报刊名查询")
    	 { 
    	 	            finding();
    	 }	 	 	 	
    	 
    	 	  if(e.getActionCommand()=="按部门查询")
    	 { 
    	 	    departmentFind();    
    	 }	 	 	 	
    ///////////////////////////////////////////////////////////、、、、、、、、、、、/预览	 
    	  if(e.getActionCommand()=="个人基本资料预览")
    	 { 
    	 	    dataBase();//连接数据库
    	 	try {    	 	
                     String query = "select * from person"; //接受输入的sql语句
                       statement = connection.createStatement(); 
                       resultSet = statement.executeQuery( query );  //执行SQL语句                      
                       displayResultSet( resultSet); //在表格中显示查询结果 
                } 
             catch ( SQLException sqlex ) { 
                                            sqlex.printStackTrace(); 
                                          }  
                                          
                      shutDown(); //断开链接           
    	 	
    	 }
  ///////////////////////////////////////////////////////////////////////  	 
    	 	 
    	   if(e.getActionCommand()=="个人订购信息预览")
    	 { 
    	 	      
    	 	       dataBase();//连接数据库
    	 	try {    	 	
                     String query = "select *from pbooknew "; //接受输入的sql语句
                       statement = connection.createStatement(); 
                       resultSet = statement.executeQuery( query );  //执行SQL语句                      
                       displayResultSet( resultSet); //在表格中显示查询结果 
                } 
             catch ( SQLException sqlex ) { 
                                            sqlex.printStackTrace(); 
                                          }  
                        shutDown();
    	 	
    	 }	 	 	 	
    	 
    	 
    	  if(e.getActionCommand()=="部门信息预览")
    	 {
    	 	            dataBase();            
            try { 
						String query ="SELECT* FROM departmentnews"; //接受输入的sql语句
						statement = connection.createStatement(); 
						resultSet = statement.executeQuery( query );//执行SQL语句 									
                        displayResultSet( resultSet);                      
                 }catch ( SQLException sqlex ) { sqlex.printStackTrace(); } 
                  shutDown();
    	 }	
    	 
    	 if(e.getActionCommand()=="部门订购信息预览")
    	 {
    	 	            dataBase();            
            try { 
						String query ="SELECT* FROM dbooknews"; //接受输入的sql

⌨️ 快捷键说明

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