Java项目:车租赁管理系统(java+Gui+文档)

源码获取:博客首页 "资源" 里下载!

功能介绍:

登陆界面、管理员界面、用户界面、汽车租赁文档

 

 

 

系统主页:

@SuppressWarnings("serial")
public class SystemMainView extends JFrame implements ActionListener{
JButton button,btnOk,select;
JScrollPane jsp;
JTextPane area=new JTextPane();
JTextField textfield;
JFileChooser fc=new JFileChooser();
File file=null;
ImageIcon imageIcon=new ImageIcon("E:\\图片册\\lan.jpg");
 public SystemMainView(){
 setTitle("药品管理系统");
 
 

  this.setSize( 900, 500);
  setResizable(false);
  setLocationRelativeTo(null);
  layoutUI();
  this.setVisible(true);
 }
 
 private void layoutUI(){

  //对象实例化
  JTabbedPane tab = new JTabbedPane(JTabbedPane.TOP); 
  //容器
  Container container = this.getLayeredPane();
  //对象化面板
  JPanel combop = new JPanel(){
		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			ImageIcon icon=new ImageIcon("E:\\图片册\\pu.jpg");
			g.drawImage(icon.getImage(), 0, 0, null);
		}
	};
  JPanel p1 = new EmployeeManagerView();
  JPanel p2 = new Medicine();
  JPanel p3 = new MarketView();
  JPanel p4 = new MarketMessage();
  JPanel p5 = new JPanel(){
		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			ImageIcon icon=new ImageIcon("E:\\图片册\\pu.jpg");
			g.drawImage(icon.getImage(), 0, 0, null);
		}
	};
	p5.add(new JButton("药品信息百科"));
	textfield=new JTextField(10);
	p5.add(textfield);
	select=new JButton("浏览");
	p5.add(select);
	select.addActionListener(this);
	p5.add(btnOk=new JButton("确定"));
	btnOk.addActionListener(this);
 
 

  tab.add(p1,"        用户管理         ");
  tab.add(p2,"       药品库存管理    ");
  tab.add(p3,"        进销管理         ");
  tab.add(p4,"       营销信息         ");
//  tab.add(p5,"       问答园地         ");
  tab.setBackground(Color.green);
  tab.setFont(new Font("Dialog",1,17));
  JLabel JL = new JLabel("药品管理系统");
  combop.add(JL);
  JL.setFont(new Font("Dialog",1,23));
  JL.setBackground(Color.green);
  container.setLayout(new BorderLayout());
  container.setBackground(Color.cyan);
  container.add(combop,BorderLayout.NORTH);
  container.add(tab,BorderLayout.CENTER);
  
 }

public void actionPerformed(ActionEvent e){
	if (e.getSource()==select){
		int intRetVal=fc.showOpenDialog(this);
		if(intRetVal==JFileChooser.APPROVE_OPTION){
		file=fc.getSelectedFile();	
		textfield.setText(file.getPath());
		}
	}
	if(e.getSource()==btnOk){
		JFrame f=new JFrame();
		f.setSize(500, 370);
		f.setLocationRelativeTo(null);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setVisible(true);
		area=new JTextPane();
		jsp=new JScrollPane(area);
		jsp.getViewport().setBackground(Color.green);
		area.setBackground(Color.cyan);
		area.setOpaque(false);
		//area.setLineWrap(true);
		//area.setWrapStyleWord(true);
		f.add(jsp);
		
		try{
			readFile(area);
		}catch(Exception ex){
			
		}
	}
}
private void readFile(JTextPane area)throws Exception{
	
	if(file !=null){
		FileReader fr=new FileReader(file);
		BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(file),"GBK"));
		try{
			
			while (br.ready()){
				area.setText(area.getText()+br.readLine()+"\r\n");
			}
		}finally{
			br.close();
			fr.close();
		}
	}
}
}

服务信息业务处理:


	package com.view;

	import java.awt.BorderLayout;
	import java.awt.Color;
	import java.awt.Dimension;
	import java.awt.Font;
import java.awt.Graphics;
	import java.awt.event.ActionEvent;
	import java.awt.event.ActionListener;
	import java.sql.ResultSet;
	import java.sql.SQLException;
	import java.util.ArrayList;

import javax.swing.ImageIcon;
	import javax.swing.JButton;
import javax.swing.JFrame;
	import javax.swing.JLabel;
	import javax.swing.JOptionPane;
	import javax.swing.JPanel;
	import javax.swing.JScrollPane;
	import javax.swing.JTable;
	import javax.swing.JTextField;
	import javax.swing.table.DefaultTableModel;

import com.db.SqlHelper;


	@SuppressWarnings("serial")
	public  class ServiceInfo  extends JFrame {
		    @SuppressWarnings("unused")
			private MarketView area;

			private DefaultTableModel dtm1 = new DefaultTableModel();
			private JTable empeJtable = new JTable(dtm1);
			private JScrollPane centerJscrollPane = new JScrollPane(empeJtable){
				public void paintComponent(Graphics g){
					super.paintComponent(g);
					ImageIcon icon=new ImageIcon("E:\\图片册\\pu.jpg");
					
					g.drawImage(icon.getImage(), 0, 0, null);
				}
			};
			

			
			private JButton returnBtn;
			private ArrayList<Object[]> datas = null;

			public ServiceInfo(MarketView area) {
				this.area=area;
				setTitle("药市信息");
				setSize(600, 300);
				setLocationRelativeTo(null);
				setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				setVisible(true);
				setLayout(new BorderLayout());
				add(centerJscrollPane);
				
				dtm1.addColumn("药品id");
				dtm1.addColumn("药品名称");
				dtm1.addColumn("入市时间");
				dtm1.addColumn("药品分类");
				dtm1.addColumn("地区市场");
				dtm1.addColumn("市场价格");
				dtm1.addColumn("流通数量");
				refreshJTable2();
				returnBtn = new JButton("返回");
				returnBtn.setBackground(Color.lightGray);
				add(returnBtn,BorderLayout.SOUTH);
				returnBtn.addActionListener(new ActionListener(){
					public void actionPerformed(ActionEvent e){
						dispose();
					}
				});
			}
				
			@SuppressWarnings({ "null", "unused" })
			private ArrayList<Object[]> getServiceInfoByDb() throws SQLException {
				ArrayList<Object[]> serviceinfomation = new ArrayList<Object[]>();
				// 查询sql语句
				String sql = "select * from serviceinfo";
				// 查询数据
				ResultSet result = new SqlHelper().query(sql, new String[] {});
			
				if (result != null) {
					while (result.next()) {
						Object rows[] = new Object[7];
						rows[0] = result.getString(1);
						rows[1] = result.getString(2);
				        rows[2] = result.getString(3);
						rows[3] = result.getString(4);
						rows[4] = result.getString(5);
						rows[5] = result.getString(6);
						rows[6] = result.getString(7);
						serviceinfomation.add(rows);
					}

				} else {
					JOptionPane.showConfirmDialog(null, "没有查询到", "提示", JOptionPane.WARNING_MESSAGE);

				}
				return serviceinfomation;
			}
			
			public void refreshJTable2() {
				dtm1.setNumRows(0);
				try {
					datas = getServiceInfoByDb();
					for (int i = 0; i < datas.size(); i++) {
						dtm1.addRow(datas.get(i));
					}

				} catch (SQLException e) {
					e.printStackTrace();
				}

			}
			
			
			

}

源码获取:博客首页 "资源" 里下载!

  • 6
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq1334611189

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值