java-车辆管理系统.doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《java-车辆管理系统.doc》由会员分享,可在线阅读,更多相关《java-车辆管理系统.doc(115页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-datejava-车辆管理系统java-车辆管理系统/车辆管理系统package javaapplication27;import javax.swing.*;import java.io.*;import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.filechooser.
2、*;import java.io.FileInputStream;/3.4CarPicture 类class CarPicture extends JPanel File imageFile; Toolkit tool; public CarPicture() tool=getToolkit(); public void setImage(File imageFile) this.imageFile=imageFile; repaint(); Override public void paintComponent(Graphics g) super.paintComponent(g); int
3、 w=getBounds().width; int h=getBounds().height; if(imageFile!=null) Image image=tool.getImage(imageFile.getAbsolutePath(); g.drawImage(image, 0,0,w,h, this); /3.3Car类class Car implements Serializable String number,name,discipling,grade,borth,sex; File imagePic; public void setNumber(String number) t
4、his.number=number; public String getNumber() return number; public void setName(String name) this.name=name; public String getName() return name; public void setDiscipling(String discipling) this.discipling=discipling; public String getDiscipling() return discipling; public void setGrade(String grad
5、e) this.grade=grade; public String getGrade() return grade; public void setBorth(String borth) this.borth=borth; public String getBorth() return borth; public void setSex(String sex) this.sex=sex; public String getSex() return sex; public void setImagePic(File image) imagePic=image; public File getI
6、magePic() return imagePic; /3.5InputCar类class InputCar extends JPanel implements ActionListener Car 车主=null; CarPicture pic; HashMap基本信息表=null; JTextField 车牌号,姓名,购车公司,购车时间; JButton 选择照片; JComboBox 档次; JRadioButton 男,女; ButtonGroup group=null; JButton 录入,重置; FileInputStream inOne=null; ObjectInputStr
7、eam inTwo=null; FileInputStream outOne=null; ObjectOutputStream outTwo=null; File systemFile,imagePic; public InputCar(File file) systemFile=file; pic=new CarPicture(); 车牌号=new JTextField(5); 姓名=new JTextField(5); 档次=new JComboBox(); try FileReader inOne = new FileReader(专业.txt); BufferedReader inTw
8、o = new BufferedReader(inOne); String s = null; int i=0; while(s=inTwo.readLine()!=null) 档次.addItem(s); inOne.close(); inTwo.close(); catch(IOException exp) 档次.addItem(高级); 档次.addItem(中高级); 档次.addItem(中级); 档次.addItem(中低级); 档次.addItem(普通); 购车公司=new JTextField(5); 购车时间=new JTextField(5); 选择照片=new JBut
9、ton(选择); group=new ButtonGroup(); 男=new JRadioButton(男,true); 女=new JRadioButton(女,true); group.add(男); group.add(女); 录入=new JButton(录入); 重置=new JButton(重置); 录入.addActionListener(this); 选择照片.addActionListener(this); 重置.addActionListener(this); Box box1=Box.createHorizontalBox(); box1.add(new JLabel(
10、车牌号:,JLabel.CENTER); box1.add(车牌号); Box box2=Box.createHorizontalBox(); box2.add(new JLabel(车主姓名:,JLabel.CENTER); box2.add(姓名); Box box3=Box.createHorizontalBox(); box3.add(new JLabel(车主性别:,JLabel.CENTER); box3.add(男); box3.add(女); Box box4=Box.createHorizontalBox(); box4.add(new JLabel(车辆档次:,JLabel
11、.CENTER); box4.add(档次); Box box5=Box.createHorizontalBox(); box5.add(new JLabel(购车公司:,JLabel.CENTER); box5.add(购车公司); Box box6=Box.createHorizontalBox(); box6.add(new JLabel(购车时间:,JLabel.CENTER); box6.add(购车时间); Box boxH=Box.createVerticalBox(); boxH.add(box1); boxH.add(box2); boxH.add(box3); boxH.a
12、dd(box4); boxH.add(box5); boxH.add(box6); boxH.add(Box.createVerticalGlue(); JPanel picPanel=new JPanel(); picPanel.setBackground(Color.green); picPanel.add(new JLabel(选择照片:,JLabel.CENTER); picPanel.add(选择照片); JPanel putButton=new JPanel(); putButton.add(录入); putButton.add(重置); JPanel messPanel=new
13、JPanel(); messPanel.add(boxH); messPanel.setBackground(Color.cyan); putButton.setBackground(Color.red); setLayout(new BorderLayout(); JSplitPane splitV=new JSplitPane(JSplitPane.VERTICAL_SPLIT,picPanel,pic); JSplitPane splitH=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,messPanel,splitV); add(splitH,B
14、orderLayout.CENTER); add(putButton,BorderLayout.SOUTH); validate(); public void actionPerformed(ActionEvent e) if(e.getSource()=录入) String number=; number=车牌号.getText(); if(number.length()0) try inOne =new FileInputStream(systemFile); inTwo =new ObjectInputStream(inOne); 基本信息表=(HashMap)inTwo.readObj
15、ect(); inOne.close(); inTwo.close(); catch(Exception ee) if(基本信息表.containsKey(number) String warning=该生基本信息已存在,请到修改页面修改!; JOptionPane.showMessageDialog(this,warning, 警告,JOptionPane.WARNING_MESSAGE); else String m=基本信息将被录入!; int ok=JOptionPane.showConfirmDialog(this,m, 确认,JOptionPane.YES_NO_OPTION,JO
16、ptionPane.INFORMATION_MESSAGE); if(ok=JOptionPane.YES_OPTION) String name=姓名.getText(); String discipling=(String)档次.getSelectedItem(); String grade=购车公司.getText(); String borth=购车时间.getText(); String sex=null; if(男.isSelected() sex=男.getText(); else sex=女.getText(); 车主=new Car(); 车主.setNumber(numbe
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 车辆 管理 系统
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内