java 车辆管理系统文档格式.docx
《java 车辆管理系统文档格式.docx》由会员分享,可在线阅读,更多相关《java 车辆管理系统文档格式.docx(33页珍藏版)》请在冰豆网上搜索。
repaint();
@Override
publicvoidpaintComponent(Graphicsg)
{super.paintComponent(g);
intw=getBounds().width;
inth=getBounds().height;
if(imageFile!
=null)
{Imageimage=tool.getImage(imageFile.getAbsolutePath());
g.drawImage(image,0,0,w,h,this);
}
//3.3Car类
classCarimplementsSerializable
{Stringnumber,name,discipling,grade,borth,sex;
FileimagePic;
publicvoidsetNumber(Stringnumber)
{this.number=number;
publicStringgetNumber()
{returnnumber;
publicvoidsetName(Stringname)
{this.name=name;
publicStringgetName()
{returnname;
publicvoidsetDiscipling(Stringdiscipling)
{this.discipling=discipling;
publicStringgetDiscipling()
{returndiscipling;
publicvoidsetGrade(Stringgrade)
{this.grade=grade;
publicStringgetGrade()
{returngrade;
publicvoidsetBorth(Stringborth)
{this.borth=borth;
publicStringgetBorth()
{returnborth;
publicvoidsetSex(Stringsex)
{this.sex=sex;
publicStringgetSex()
{returnsex;
publicvoidsetImagePic(Fileimage)
{imagePic=image;
publicFilegetImagePic()
{returnimagePic;
//3.5InputCar类
classInputCarextendsJPanelimplementsActionListener
{Car车主=null;
CarPicturepic;
HashMap<
String,Car>
基本信息表=null;
JTextField车牌号,姓名,购车公司,购车时间;
JButton选择照片;
JComboBox档次;
JRadioButton男,女;
ButtonGroupgroup=null;
JButton录入,重置;
FileInputStreaminOne=null;
ObjectInputStreaminTwo=null;
FileInputStreamoutOne=null;
ObjectOutputStreamoutTwo=null;
FilesystemFile,imagePic;
publicInputCar(Filefile)
{systemFile=file;
pic=newCarPicture();
车牌号=newJTextField(5);
姓名=newJTextField(5);
档次=newJComboBox();
try{FileReaderinOne=newFileReader("
专业.txt"
);
BufferedReaderinTwo=newBufferedReader(inOne);
Strings=null;
inti=0;
while((s=inTwo.readLine())!
档次.addItem(s);
inOne.close();
inTwo.close();
catch(IOExceptionexp){
档次.addItem("
高级"
中高级"
中级"
中低级"
普通"
购车公司=newJTextField(5);
购车时间=newJTextField(5);
选择照片=newJButton("
选择"
group=newButtonGroup();
男=newJRadioButton("
男"
true);
女=newJRadioButton("
女"
group.add(男);
group.add(女);
录入=newJButton("
录入"
重置=newJButton("
重置"
录入.addActionListener(this);
选择照片.addActionListener(this);
重置.addActionListener(this);
Boxbox1=Box.createHorizontalBox();
box1.add(newJLabel("
车牌号:
"
JLabel.CENTER));
box1.add(车牌号);
Boxbox2=Box.createHorizontalBox();
box2.add(newJLabel("
车主姓名:
box2.add(姓名);
Boxbox3=Box.createHorizontalBox();
box3.add(newJLabel("
车主性别:
box3.add(男);
box3.add(女);
Boxbox4=Box.createHorizontalBox();
box4.add(newJLabel("
车辆档次:
box4.add(档次);
Boxbox5=Box.createHorizontalBox();
box5.add(newJLabel("
购车公司:
box5.add(购车公司);
Boxbox6=Box.createHorizontalBox();
box6.add(newJLabel("
购车时间:
box6.add(购车时间);
BoxboxH=Box.createVerticalBox();
boxH.add(box1);
boxH.add(box2);
boxH.add(box3);
boxH.add(box4);
boxH.add(box5);
boxH.add(box6);
boxH.add(Box.createVerticalGlue());
JPanelpicPanel=newJPanel();
picPanel.setBackground(Color.green);
picPanel.add(newJLabel("
选择照片:
picPanel.add(选择照片);
JPanelputButton=newJPanel();
putButton.add(录入);
putButton.add(重置);
JPanelmessPanel=newJPanel();
messPanel.add(boxH);
messPanel.setBackground(Color.cyan);
putButton.setBackground(Color.red);
setLayout(newBorderLayout());
JSplitPanesplitV=newJSplitPane(JSplitPane.VERTICAL_SPLIT,picPanel,pic);
JSplitPanesplitH=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,messPanel,splitV);
add(splitH,BorderLayout.CENTER);
add(putButton,BorderLayout.SOUTH);
validate();
publicvoidactionPerformed(ActionEvente){
if(e.getSource()==录入){
Stringnumber="
;
number=车牌号.getText();
if(number.length()>
0){
try{
inOne=newFileInputStream(systemFile);
inTwo=newObjectInputStream(inOne);
基本信息表=(HashMap<
)inTwo.readObject();
catch(Exceptionee){}
if(基本信息表.containsKey(number)){
Stringwarning="
该生基本信息已存在,请到修改页面修改!
JOptionPane.showMessageDialog(this,warning,"
警告"
JOptionPane.WARNING_MESSAGE);
else{
Stringm="
基本信息将被录入!
intok=JOptionPane.showConfirmDialog(this,m,"
确认"
JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE);
if(ok==JOptio