java车辆管理系统Word文档格式.docx
- 文档编号:20599221
- 上传时间:2023-01-24
- 格式:DOCX
- 页数:33
- 大小:23.74KB
java车辆管理系统Word文档格式.docx
《java车辆管理系统Word文档格式.docx》由会员分享,可在线阅读,更多相关《java车辆管理系统Word文档格式.docx(33页珍藏版)》请在冰豆网上搜索。
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==JOptionPane.YES_OPTION){
Stringname=姓名.getText();
Stringdiscipling=(String)档次.getSelectedItem();
Stringgrade=购车公司.getText();
Stringborth=购车时间.getText();
Stringsex=null;
if(男.isSelected())
sex=男.getText();
else
sex=女.getText();
车主=newCar();
车主.setNumber(number);
车主.setName(name);
车主.setDiscipling(discipling);
车主.setGrade(grade);
车主.setBorth(borth);
车主.setSex(sex);
车主.setImagePic(imagePic);
try{FileOutputStreamoutOne=newFileOutputStream(systemFile);
outTwo=newObjectOutputStream(outOne);
基本信息表.put(number,车主);
outTwo.writeObject(基本信息表);
outTwo.close();
outOne.close();
clearMess();
必须要输入学号!
elseif(e.getSource()==选择照片){
JFileChooserchooser=newJFileChooser();
FileNameExtensionFilterfilter=newFileNameExtensionFilter("
JPG&
GIFImages"
"
jpg"
gif"
chooser.setFileFilter(filter);
intstate=chooser.showOpenDialog(null);
FilechoiceFile=chooser.getSelectedFile();
if(choiceFile!
=null&
&
state==JFileChooser.APPROVE_OPTION){
选择照片.setText(choiceFile.getName());
imagePic=choiceFile;
pic.setImage(imagePic);
pic.repaint();
elseif(e.getSource()==重置){
publicvoidclearMess(){
车牌号.setText(null);
姓名.setText(null);
购车公司.setText(null);
购车时间.setText(null);
选择照片.setText("
imagePic=null;
//3.6inquset类
classInquestextendsJDialogimplementsActionListener{
PrintJobprint;
Graphicsg=null;
基本信息表;
JTextField车牌号,姓名,档次,购车公司,购车时间;
JButton查询,打印文本及照片,打印文本,打印照片;
FilesystemFile=null;
JPanelmessPanel;
Carstu;
publicInquest(Filefile){
setTitle("
查询对话框"
setModal(false);
systemFile=file;
车牌号=newJTextField(6);
查询=newJButton("
查询"
车牌号.addActionListener(this);
查询.addActionListener(this);
打印文本及照片=newJButton("
打印文本及照片"
打印文本=newJButton("
打印文本"
打印照片=newJButton("
打印照片"
打印文本及照片.addActionListener(this);
打印文本.addActionListener(this);
打印照片.addActionListener(this);
打印文本及照片.setEnabled(false);
打印文本.setEnabled(false);
打印照片.setEnabled(false);
姓名.setEditable(false);
档次=newJTextField(5);
档次.setEditable(false);
购车公司.setEditable(false);
购车时间.setEditable(false);
false);
Boxbox1=Box.createHorizontalBox();
车牌号:
box1.add(查询);
Boxbox2=Box.createHorizontalBox();
车主姓名:
Boxbox3=Box.createHorizontalBox();
性别:
Boxbox4=Box.createHorizontalBox();
档次:
Boxbox5=Box.createHorizontalBox();
购车公司:
Boxbox6=Box.createHorizontalBox();
购车时间:
messPanel=newJPanel();
JSplitPanesplitH=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,messPanel,pic);
JPanelpSouth=newJPanel();
pSouth.add(打印文本及照片);
pSouth.add(打印文本);
pSouth.add(打印照片);
add(pSouth,BorderLayout.SOUTH);
setVisible(false);
setSize(360,230);
addWindowListener(newWindowAdapter(){
publicvoidwindowClosing(WindowEvente){
}});
if(e.getSource()==查询||e.getSource()==车牌号){
stu=基本信息表.get(number);
姓名.setText(stu.getName());
档次.setText(stu.getDiscipling());
购车公司.setText(stu.getGrade());
购车时间.setText(stu.getBorth());
if(stu.getSex().equals("
))
男.setSelected(true);
女.setSelected(true);
pic.setImage(stu.getImagePic());
打印文本及照片.setEnabled(true);
打印文本.setEnabled(true);
打印照片.setEnabled(true);
该车牌号不存在!
必须要输入车牌号!
JOptionPane.WARNING_MESSAGE);
elseif(e.getSource()==打印文本及照片){
print=getToolkit().getPrintJob(newJFrame(),"
打印"
newProperties());
g=print.getGraphics();
g.translate(120,200);
intw=messPanel.getBounds().width;
messPanel.printAll(g);
g.translate(w,0);
pic.printAll(g);
g.dispose();
print.end();
catch(Exceptionexp){}
elseif(e.getSource()==打印文本){
g=print.getGraphic
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 车辆 管理 系统