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

📄 ww.java

📁 java设计,一个nike员工管理系统
💻 JAVA
字号:

import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
class tt extends Frame implements ActionListener
 { TextField text1,text2;
   Label label1,label2,label3;
   Button button1,button2;
   Connection con =null;Statement stmt=null;
   pp kz;
   tt( )
   { super("登陆窗口");
    setBackground(Color.green);
    setBounds(100,100,150,200);
    setVisible(true);
    validate();
    kz=new pp();
    text1=new TextField(10);
    text2=new TextField(10);
    label1=new Label("用户名");
    label2=new Label("密码");
    label3=new Label("欢迎使用此系统");
    button1=new Button("登陆");
    button2=new Button("取消");
    setLayout(new BorderLayout());
    Panel p1=new Panel();
    Panel p2=new Panel();
    p1.add(label1);p1.add(text1);
    p1.add(label2);p1.add(text2);
    add(p1,BorderLayout.CENTER);
    p2.add(button1);p2.add(button2);
    add(p2,BorderLayout.SOUTH);
    button1.addActionListener(this);
    button2.addActionListener(this);
    try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}
    catch(ClassNotFoundException e){ }
    try{
         con=DriverManager.getConnection("jdbc:odbc:zanzu","","");
         stmt=con.createStatement();
         }
    catch(SQLException ee) { }
    addWindowListener(new WindowAdapter()
                  { public void windowClosing(WindowEvent e)
                     {System.exit(0);}
                     });
   }
  public void actionPerformed(ActionEvent e)
  {if(e.getSource()==button1)
     try{ dl();}
     catch(SQLException ee){}
   else if(e.getSource()==button2)
       {text1.setText(null);
        text2.setText(null);}
   }
   public void dl() throws SQLException
    { String name ,ma;
      con=DriverManager.getConnection("jdbc:odbc:zanzu","","");
      ResultSet rs=stmt.executeQuery("select * from yonghu");
      while(rs.next())
        { name=rs.getString("用户名");
          ma=rs.getString("密码");
          if(name.equals(text1.getText())&&ma.equals(text2.getText()))
            { JOptionPane.showMessageDialog(this,"输入正确","警告",JOptionPane.WARNING_MESSAGE);
              setVisible(false);
              kz.setVisible(true);}
          else if( !(name.equals(text1.getText())&&ma.equals(text2.getText())))
              { JOptionPane.showMessageDialog(this,"输入错误","警告",JOptionPane.WARNING_MESSAGE);
                text1.setText(null);
                text2.setText(null);
              }
          }
          con.close();
      }
 }
 class pp extends Frame
  { MenuBar bar;
    Menu menu1,menu2,menu3,menu4;
    MenuItem item1,item3,item4,item5,item6;
    pp()
     { super("操作窗口");
       bar=new MenuBar();
       menu1=new Menu("用户处理");
       menu2=new Menu("现居处理");
       menu3=new Menu("来源处理");
       menu4=new Menu("留言板");
       item1=new MenuItem("处理用户");
       item3=new MenuItem("退出");
       item4=new MenuItem("查询");
       item5=new MenuItem("留言");
       item6=new MenuItem("处理");
       menu1.add(item1);
       menu1.add(item3);
       menu2.add(item4);
       menu4.add(item5);
       menu3.add(item6);
       bar.add(menu1);
       bar.add(menu2);
       bar.add(menu3);
       bar.add(menu4);
       setMenuBar(bar);

       setBounds(100,120,250,200);
       setBackground(Color.green);
       validate();
       setVisible(false);
       addWindowListener(new WindowAdapter()
	                     { public void windowClosing(WindowEvent e)
	                        {System.exit(0);}
                     });
     }
   }





public class ww
   {
	   public static void main (String args[])
        {
		  tt denglu=new tt(); denglu.pack();
		  }

    }



⌨️ 快捷键说明

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