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

📄 login.java

📁 一个货物管理系
💻 JAVA
字号:
package good;
import java.awt.*;
import java.awt.event.*;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.swing.*;



public class Login extends JFrame implements ActionListener{

	private static final int CENTER = 0;
	/**
	 * @param args
	 */
	  String user="1";
	  String pass="1";
	  protected static int check;
	 
  public  Login()
  {	
	 
	 Container container=this.getContentPane();
	 JPanel staticPanel=new JPanel(new GridLayout(2,2),true);
	 JPanel staticPanel1=new JPanel(new FlowLayout(),true);
	 JLabel userL= new JLabel("用户名称",CENTER);
	 JLabel passwordL= new JLabel("密码",CENTER);
	
	 final JTextField  userField=new JTextField("",10);
	 final JTextField  passwordField=new JTextField("",10); 
	 
	 JButton okButton=new JButton("确定");
	 JButton cancelButton=new JButton("取消");
	 //jj.getContentPane().add(container);
	 
	 container.add(staticPanel,"Center");	  
	 container.add(staticPanel1,"South");	
	 staticPanel.add(userL);
	 staticPanel.add(userField);
	 staticPanel.add(passwordL);
	 staticPanel.add(passwordField);
	
	 staticPanel1.add(okButton);
	 staticPanel1.add(cancelButton);
	 okButton.addActionListener(new ActionListener(){

			public  void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated meithod stub
				
				if (userField.getText().trim().compareTo(user)==0 && passwordField.getText().trim().compareTo(pass)==0 )
				{
					
					setMemu();
					dispose(); 
					
				}
				else 
				{
					check=0;
					JOptionPane.showConfirmDialog(Login.this,"密码或用户名错误","提示",
					JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE );
					
				}
				 
				dispose(); 
				
			}
			
	    	
	    });
	
	    cancelButton.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				dispose();
				
			}
	    	
	    });
	    addWindowListener(new WindowAdapter()
	            { public void windowClosing(WindowEvent e){      	
	                  			   
	                   dispose();                  
	                   
	              }});    
	   this.setSize(200,150);
	   this.setBounds(0,50,200,120);
	  
	   this.show();
	  
	   
	  }
  public void setMemu()
  {
 	
	  Mainframe.employeeMenu.setEnabled( true);    	
	  Mainframe.clientMenu.setEnabled( true);    	
	  Mainframe.imanufacturerMenu.setEnabled( true);    	
	  Mainframe.goodmodiItem.setEnabled( true); 
	  Mainframe.goodaddItem .setEnabled( true); 
	  Mainframe.ioItem .setEnabled( true); 
	  Mainframe.goodsdeleItem .setEnabled( true); 
  } 

	public void actionPerformed(ActionEvent actionEvent) {	
		
	  }
	

}

⌨️ 快捷键说明

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