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

📄 flowpasswordgui.java

📁 图书管理系统。 借书
💻 JAVA
字号:
package GUI;


import shujuku.*;

import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;



public class FlowPasswordGUI extends JFrame implements ActionListener
{
	  /*public void actionPerformed(ActionEvent e)
	  {
	   if(e.getActionCommand().equals("取消"))
	   {
	    dispose();
	   }
	   else if(e.getActionCommand().equals("确定"))
	   {
	    //检验操作员口令是否正确.若正确则以下
	    if(true)
	    {
	     FlowGUI g=new FlowGUI();
	     dispose();
	    }
	    //若不正确则以下
	    else
	    {}
	   }
	  }*/
	JTextField a1=new JTextField(15);
    JTextField a2=new JTextField(15); JPasswordField te2;
    JTextField a3=new JTextField(15); JPasswordField te3;
    JTextField a4=new JTextField(15);
    JTextField a5=new JTextField(15);
    JTextField a6=new JTextField(15);
		 public void actionPerformed(ActionEvent e){
			 String com=e.getActionCommand();
			 if(com.equals("取消")){
				 GUIClass go=new GUIClass();
				 go.setVisible(true);
				 show();
				 dispose();
			 }
			 else if(com.equals("确定")){
				String a=a1.getText();
				 String b=te3.getText();
				 try{
					 Connection con=LinkToDB.buildlinktodb();
						Statement state = con.createStatement();
						ResultSet result = state
								.executeQuery("SELECT Password FROM 管理员 WHERE WorkerId='"+a+"'");
							while (result.next()){String x = result.getString("Password");
								if(x.equals(b)){
			    			BFlowGUI go=new BFlowGUI();
			   			 go.setVisible(true);
			   			 show();
			   			 dispose();}
			    		else
			    			JOptionPane.showMessageDialog(this,"              密码错误");}
			    		result.close();
			    		state.close();
			    		con.close();
			    	}
			    	catch(Exception f){
			    		System.out.println(f);}}
			    	}
	  public FlowPasswordGUI()
	  {
	   setSize(500,300);
	   setTitle("操作");
	   Dimension screen = getToolkit().getScreenSize();  //得到屏幕尺寸
	    setLocation((screen.width-getSize().width)/2,(screen.height-getSize().height)/2); //设置窗口位置
	   Container con=getContentPane();
	   con.setLayout(new GridLayout(3,1));
	   JLabel l1=new JLabel("操作员号码",JLabel.CENTER);
	   JLabel l2=new JLabel("操作员口令",JLabel.CENTER);
	   JPanel p1=new JPanel();p1.setBackground(Color.LIGHT_GRAY);
	   JPanel p2=new JPanel();p2.setBackground(Color.LIGHT_GRAY);
	   te3=new JPasswordField(15);te3.setEchoChar('*');
	   p1.add(l1);p1.add(a1);p2.add(l2);p2.add(te3);
	   JPanel b=new JPanel();b.setBackground(Color.LIGHT_GRAY);
	   JButton b1=new JButton("确定");JButton b2=new JButton("取消");
	   b1.addActionListener(this);b2.addActionListener(this);
	   b.add(b1);b.add(b2);
	   con.add(p1);con.add(p2);con.add(b);
	   setVisible(true);
	  }
	  public static void main(String args[]){
		  FlowPasswordGUI gui=new FlowPasswordGUI();
		  gui.setVisible(true);
	  }
	 }

⌨️ 快捷键说明

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