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

📄 bikeinfo.java

📁 关于自行车店管理系统的源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		 	  		resume.setText("");	
		 	  		photo.setIcon(new ImageIcon("2.gif"));
		  	 	}
		 	 }
		 	 catch(SQLException ee5)
		   	{
			}
		}
		
		
		
		if(e.getSource()==previous)
		{
			Connection con=null;
   		 	Statement sql=null;
		    ResultSet result;
    		try
    		{
	   		 	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    		}
	   		catch(ClassNotFoundException e5)
	  	 	{
	   			System.out.println(""+e5);
    		}
	   		try
	   		{
		 	  	con=DriverManager.getConnection("jdbc:odbc:me2","zww","123");
		  	 	sql=con.createStatement();
		  	 	sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
		  	 	result=sql.executeQuery("SELECT * FROM student");
		  	 	String temps=studentnumber.getText();
		 	  	long templong=Long.parseLong(temps);
		 	 	boolean tempbool=false;
		 	 	boolean tempbool2=false;
		 	 	result.afterLast();
		 	 	while(result.previous())
		 	 	{
		 	 		if(tempbool2==true)
		 	 		{
		 	 			long templong2=result.getLong("sn");
		  	 			String tempsn=String.valueOf(templong2);
		  	 			studentnumber.setText(tempsn);		 	  			
		 	  			name.setText(result.getString("name"));
		 	  			password.setText(result.getString("password"));
		 	  			telephone.setText(result.getString("telephone"));
		 	  			adress.setText(result.getString("adress"));
		 	  			sex.setSelectedIndex(result.getInt("sex"));
		 	  			party.setSelected(result.getBoolean("party"));
		 	  			int tempage=result.getInt("age");
		 	  			String tempage1=String.valueOf(tempage);
		 	  			age.setText(tempage1);
		 	  			grade.setSelectedIndex(result.getInt("grade"));
		 	  			resume.setText(result.getString("resume"));
		 	  			photo.setIcon(new ImageIcon(result.getString("photo")));
		 	  			
		 	  			tempbool2=false;
		 	 		}
		 	 		if(result.getLong("sn")==templong)
		 	 		{
		 	 			tempbool=true;
		 	 			tempbool2=true;		  	 					  	 			
		 	 		}
		 	 	}
		 	 	if(tempbool==false)
		  	 	{
		  	 		JOptionPane.showMessageDialog(this,"该号不存在,请重新输入!","警告:",JOptionPane.WARNING_MESSAGE);
		  	 		studentnumber.setText("");		 	  			
		 		  	name.setText("");
		 	 	 	password.setText("");
		 	  		telephone.setText("");
		 	  		adress.setText("");
		 	  		sex.setSelectedIndex(0);
		 	  		party.setSelected(false);
		 	  		age.setText("");
		 	  		grade.setSelectedIndex(0);
		 	  		resume.setText("");
		 	  		photo.setIcon(new ImageIcon("2.gif"));
		  	 	}
		 	 }
		 	 catch(SQLException ee5)
		   	{
			}
		}
		if(e.getSource()==first)
		{
			Connection con=null;
   		 	Statement sql=null;
		    ResultSet result;
    		try
    		{
	   		 	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    		}
	   		catch(ClassNotFoundException e5)
	  	 	{
	   			System.out.println(""+e5);
    		}
	   		try
	   		{
		 	  	con=DriverManager.getConnection("jdbc:odbc:me2","zww","123");
		  	 	sql=con.createStatement();
		  	 	result=sql.executeQuery("SELECT * FROM student");
		 	 	boolean once=false;
		 	 	while(result.next()&&once==false)
		 	 	{
		 	 		long templong2=result.getLong("sn");
		  	 		String tempsn=String.valueOf(templong2);
		  	 		studentnumber.setText(tempsn);		 	  			
		 	  		name.setText(result.getString("name"));
		 	  		password.setText(result.getString("password"));
		 	  		telephone.setText(result.getString("telephone"));
		 	  		adress.setText(result.getString("adress"));
		 	  		sex.setSelectedIndex(result.getInt("sex"));
		 	  		party.setSelected(result.getBoolean("party"));
		 	  		int tempage=result.getInt("age");
		 	  		String tempage1=String.valueOf(tempage);
		 	  		age.setText(tempage1);
		 	  		grade.setSelectedIndex(result.getInt("grade"));
		 	  		resume.setText(result.getString("resume"));	
		 	  		photo.setIcon(new ImageIcon(result.getString("photo")));	 	  			
		 	  		once=true;
		 	 	}

		 	 }
		 	 catch(SQLException ee5)		 
		   	{
			}
		}
		
		if(e.getSource()==last)
		{
			Connection con=null;
   		 	Statement sql=null;
		    ResultSet result;
    		try
    		{
	   		 	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    		}
	   		catch(ClassNotFoundException e5)
	  	 	{
	   			System.out.println(""+e5);
    		}
	   		try
	   		{
		 	  	con=DriverManager.getConnection("jdbc:odbc:me2","zww","123");
		  	 	sql=con.createStatement();
		  	 	sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
		  	 	result=sql.executeQuery("SELECT * FROM student");
		 	 	boolean once=false;
		 	 	result.afterLast();
		 	 	while(result.previous()&&once==false)
		 	 	{
		 	 		long templong2=result.getLong("sn");
		  	 		String tempsn=String.valueOf(templong2);
		  	 		studentnumber.setText(tempsn);		 	  			
		 	  		name.setText(result.getString("name"));
		 	  		password.setText(result.getString("password"));
		 	  		telephone.setText(result.getString("telephone"));
		 	  		adress.setText(result.getString("adress"));
		 	  		sex.setSelectedIndex(result.getInt("sex"));
		 	  		party.setSelected(result.getBoolean("party"));
		 	  		int tempage=result.getInt("age");
		 	  		String tempage1=String.valueOf(tempage);
		 	  		age.setText(tempage1);
		 	  		grade.setSelectedIndex(result.getInt("grade"));
		 	  		resume.setText(result.getString("resume"));	
		 	  		photo.setIcon(new ImageIcon(result.getString("photo")));	 	  			
		 	  		once=true;
		 	 	}

		 	 }
		 	 catch(SQLException ee5)		 
		   	{
			}
		}
	}
}
//------------------------------------------------------------------------------------------------------------------------------
class BikeOut extends JFrame implements ActionListener
{
	static int idcount=0;
	static int idcount2=0;
	JTextField studentnumber;
	JTextField name;
	JTextField password;
	JTextField telephone;
	JTextField adress;
	JComboBox sex;
	JCheckBox party;
	JTextField age;
	JComboBox grade;
	JButton backcolor;
	JButton forcolor;
	JLabel photo;
	JButton photoButton;
	JTextArea resume;
	JSplitPane split_one;
	JSplitPane split_two;
	JSplitPane split_three;
	
	JButton add;
	JButton delete;
	JButton search;
	JButton change;
	JButton next;
	JButton previous;
	JButton first;
	JButton last;
	
	JTable table;
	DefaultTableModel model;
	
	JCheckBoxMenuItem toolbarVisible;
	JMenuItem count;
	JMenuItem exit;
	
	JToolBar toolbar;
	JButton countButton;
	JButton exitButton;
	
	JLabel dispTime;
	JLabel position=new JLabel();
	
	int num=0;
	
	String filenamepath="2.gif";
	
	BikeOut()
	{
		super("自行车进库管理系统");
		
		addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				//System.exit(0);
				//System.runFinalizersOnExit(false);
				System.runFinalization();
				//new ExitWindow();
			}
		});
		
		Container con=getContentPane();
		
		JMenuBar menubar=new JMenuBar();
		JMenu menu=new JMenu("功能");
		toolbarVisible=new JCheckBoxMenuItem("显示/隐藏工具条",true);
		toolbarVisible.addActionListener(this);
		count=new JMenuItem("统计数量");
		count.setActionCommand("count");
		count.addActionListener(this);
		exit=new JMenuItem("Exit",'x');
		exit.addActionListener(this);
		exit.setActionCommand("exit");
  		exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,InputEvent.ALT_MASK));
		menu.add(toolbarVisible);
		menu.addSeparator();
		menu.add(count);
		menu.addSeparator();
		menu.add(exit);
		menubar.add(menu);
		setJMenuBar(menubar);
		
		countButton=new JButton("统计数量");
		countButton.setActionCommand("count");
		countButton.addActionListener(this);
		countButton.setToolTipText("统计当前已输入的学生人数");
		exitButton=new JButton("退出");
		exitButton.addActionListener(this);
		exitButton.setActionCommand("exit");
		exitButton.setToolTipText("退出本系统");
		toolbar=new JToolBar();
		toolbar.add(countButton);
		toolbar.addSeparator();
		toolbar.add(exitButton);
		con.add(toolbar,"North");
		
		Box snBox=Box.createHorizontalBox();
		studentnumber=new JTextField(20);
		snBox.add(new JLabel("代号"));
		snBox.add(Box.createHorizontalStrut(5));
		snBox.add(studentnumber);
		snBox.add(Box.createHorizontalGlue());

		Box nameBox=Box.createHorizontalBox();
		name=new JTextField(20);
		nameBox.add(new JLabel("型号"));
		nameBox.add(Box.createHorizontalStrut(5));
		nameBox.add(name);
		nameBox.add(Box.createHorizontalGlue());
		
		Box passwordBox=Box.createHorizontalBox();
		password=new JTextField(20);
		passwordBox.add(new JLabel("大小"));
		passwordBox.add(Box.createHorizontalStrut(5));
		passwordBox.add(password);
		passwordBox.add(Box.createHorizontalGlue());
		
		Box telephoneBox=Box.createHorizontalBox();
		telephone=new JTextField(20);
		telephoneBox.add(new JLabel("电话"));
		telephoneBox.add(Box.createHorizontalStrut(5));
		telephoneBox.add(telephone);
		telephoneBox.add(Box.createHorizontalGlue());
		
		Box adressBox=Box.createHorizontalBox();
		adress=new JTextField(20);
		adressBox.add(new JLabel("地址"));
		adressBox.add(Box.createHorizontalStrut(5));
		adressBox.add(adress);
		adressBox.add(Box.createHorizontalGlue());
		
		Box sexBox=Box.createHorizontalBox();
		sex=new JComboBox();
		sex.addItem("男");
		sex.addItem("女");
		sexBox.add(new JLabel("样式"));
		sexBox.add(Box.createHorizontalStrut(5));
		sexBox.add(sex);
		sexBox.add(Box.createHorizontalGlue());
		
		Box partyBox=Box.createHorizontalBox();
		party=new JCheckBox();
		party.setHorizontalTextPosition(JCheckBox.LEFT);
		party.setSelected(false);
		partyBox.add(new JLabel("合格"));
		partyBox.add(Box.createHorizontalStrut(5));
		partyBox.add(party);
		partyBox.add(Box.createHorizontalGlue());

		Box ageBox=Box.createHorizontalBox();
		age=new JTextField(20);
		ageBox.add(new JLabel("数量"));
		ageBox.add(Box.createHorizontalStrut(5));
		ageBox.add(age);
		ageBox.add(Box.createHorizontalGlue());
		
		Box gradeBox=Box.createHorizontalBox();
		grade=new JComboBox();
		grade.addItem("一级品");
		grade.addItem("二级品");
		grade.addItem("三级品");
		grade.addItem("四级品");
		gradeBox.add(new JLabel("等级"));
		gradeBox.add(Box.createHorizontalStrut(5));
		gradeBox.add(grade);
		gradeBox.add(Box.createHorizontalGlue());

		Box colorBox=Box.createHorizontalBox();
		
		forcolor=new JButton("前景色");
		forcolor.addActionListener(this);
		backcolor=new JButton("背景色");
		backcolor.addActionListener(this);
		colorBox.add(new JLabel("颜色"));
		colorBox.add(Box.createHorizontalStrut(5));
		colorBox.add(forcolor);
		colorBox.add(Box.createHorizontalStrut(5));
		colorBox.add(backcolor);
		colorBox.add(Box.createHorizontalGlue());

		Box photoBox=Box.createVerticalBox();
		photoButton=new JButton("选择照片");
		photoButton.addActionListener(this);
		photo=new JLabel(new ImageIcon("2.gif"));
              photoBox.add(photo);
		photoBox.add(Box.createVerticalStrut(10));
		photoBox.add(photoButton);
		photoBox.add(Box.createVerticalGlue());
		photoBox.add(new JScrollPane(photo));
		photoBox.add(Box.createVerticalStrut(10));
		
		Box resumeBox=Box.createVerticalBox();
		resume=new JTextArea(11,28);
		String a=new String();
		a="天是透明的 因为雪慢慢的停了\n心是透明的 因为我不想隐藏了 \n天是透明的 因为黑夜已过去了 \n因为你对我笑了 所以想念很快乐 \n心是透明的 因为有你永远陪着 \n因为你决定爱了 所以等待也是值得\n你看不到我的苍凉,我依然带你去飞翔;\n你看不到我的迷惘,我依然带你去流浪; \n你找不到的地方,我和你一起跳舞`歌唱; \n你找不到的天堂,我把它拿来放在你手上。 \n";
		resume.setText(a);
		resume.setForeground(Color.BLUE);
		resumeBox.add(resume);
		resumeBox.add(Box.createVerticalStrut(10));
		resumeBox.add(new JLabel("简介"));
		resumeBox.add(Box.createVerticalGlue());
		resumeBox.add(new JScrollPane(resume));
		resumeBox.add(Box.createVerticalStrut(10));

		Box leftBox=Box.createVerticalBox();
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(snBox);
		
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(nameBox);
		
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(passwordBox);
		
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(sexBox);
		
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(ageBox);
		
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(gradeBox);
		
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(partyBox);
		
		leftBox.add(Box.createVerticalStrut(10));
		leftBox.add(telephoneBox);

⌨️ 快捷键说明

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