@ -0,0 +1,28 @@
|
||||
package com.utils;
|
||||
|
||||
import java.awt.Container;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
// 背景图片设置
|
||||
public class BackgroundImagelyx {
|
||||
public BackgroundImagelyx(JFrame frame,Container container,String ImageName) {
|
||||
// 限定加载图片路径
|
||||
ImageIcon icon= new ImageIcon("res/" + ImageName);
|
||||
|
||||
final JLabel labelBackground = new JLabel();
|
||||
ImageIcon iconBookManageSystemBackground = icon;
|
||||
labelBackground.setIcon(iconBookManageSystemBackground);
|
||||
// 设置label的大小
|
||||
labelBackground.setBounds(0,0,iconBookManageSystemBackground.getIconWidth()
|
||||
,iconBookManageSystemBackground.getIconHeight());
|
||||
//将背景图片标签放入桌面面板的最底层
|
||||
frame.getLayeredPane().add(labelBackground,new Integer(Integer.MIN_VALUE));
|
||||
// 将容器转换为面板设置为透明
|
||||
JPanel panel = (JPanel)container;
|
||||
panel.setOpaque(false);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.dao;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.entity.Carlyx;
|
||||
import com.mysql.jdbc.Connection;
|
||||
import com.mysql.jdbc.Statement;
|
||||
import com.utils.DBUtilhxr;
|
||||
|
||||
public class CarDaolyx {
|
||||
// 添加表信息
|
||||
public void addCar(Carlyx car)throws Exception {
|
||||
Connection con = (Connection) DBUtilhxr.getConnection();
|
||||
String sql="insert into car_info"
|
||||
+"(car_id,model,color,manufactory,factory_date,price)"
|
||||
+"values(?,?,?,?,?,?)";
|
||||
PreparedStatement psmt = con.prepareStatement(sql);
|
||||
psmt.setInt(1, car.getCar_id());
|
||||
psmt.setString(2, car.getModel());
|
||||
psmt.setString(3, car.getColor());
|
||||
psmt.setString(4, car.getManufactory());
|
||||
psmt.setString(5, car.getFactory_date());
|
||||
psmt.setString(6, car.getPrice());
|
||||
try {
|
||||
psmt.executeUpdate();
|
||||
JOptionPane.showMessageDialog(null, "数据插入成功","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "数据插入失败 ","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
con.close();
|
||||
}
|
||||
//删除汽车信息
|
||||
public void delCar(int car_id ) throws SQLException {
|
||||
Connection con=(Connection) DBUtilhxr.getConnection();
|
||||
String sql="" +
|
||||
"DELETE FROM car_info "+
|
||||
"WHERE car_id = ?";
|
||||
// 预编译sql语句
|
||||
PreparedStatement psmt = con.prepareStatement(sql);
|
||||
psmt.setInt(1, car_id);
|
||||
try {
|
||||
psmt.execute();
|
||||
JOptionPane.showMessageDialog(null, "数据删除成功","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
JOptionPane.showMessageDialog(null, "数据删除失败","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
|
||||
}
|
||||
// 修改Car信息
|
||||
public void changeCar(Carlyx car) throws SQLException {
|
||||
// System.out.println(car.getCar_id()+car.getColor()+car.getModel()+car.getManufactory()+car.getFactory_date()+car.getPrice());
|
||||
String model = car.getModel();
|
||||
String color = car.getColor();
|
||||
String manufactory = car.getManufactory();
|
||||
String factory_date= car.getFactory_date();
|
||||
String price = car.getPrice();
|
||||
Integer car_id = car.getCar_id();
|
||||
Connection con = (Connection) DBUtilhxr.getConnection();
|
||||
String sql = "update car_info "
|
||||
+ "set model=\""+model+"\","
|
||||
+ "color=\""+color+"\","
|
||||
+"manufactory=\""+manufactory+"\","
|
||||
+"factory_date=\""+factory_date+"\","
|
||||
+ "price=\""+price+"\" "
|
||||
+"where car_id ="+car_id+";";
|
||||
Statement psmt = (Statement) con.createStatement();
|
||||
try {
|
||||
psmt.executeUpdate(sql);
|
||||
JOptionPane.showMessageDialog(null, "数据修改成功","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
JOptionPane.showMessageDialog(null, "数据修改失败","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
}
|
||||
// 查询表信息
|
||||
public List<Carlyx> query() throws Exception{
|
||||
Connection con=(Connection) DBUtilhxr.getConnection();
|
||||
Statement stmt=(Statement) con.createStatement();
|
||||
ResultSet rs= stmt.executeQuery("select car_id,model,color,manufactory,"+
|
||||
"factory_date,price from car_info");
|
||||
List<Carlyx> carList = new ArrayList<Carlyx>();
|
||||
Carlyx car=null;
|
||||
while (rs.next()) {
|
||||
car = new Carlyx();
|
||||
car.setCar_id(Integer.parseInt(rs.getString("car_id")));
|
||||
car.setModel(rs.getString("model"));
|
||||
car.setColor(rs.getString("color"));
|
||||
car.setManufactory(rs.getString("manufactory"));
|
||||
car.setFactory_date(rs.getString("factory_date"));
|
||||
car.setPrice(rs.getString("price"));
|
||||
carList.add(car);
|
||||
}
|
||||
return carList;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,277 @@
|
||||
package com.view;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import com.controller.CarActionlyx;
|
||||
import com.utils.BackgroundImagelyx;
|
||||
import com.utils.FrameOptionlyx;
|
||||
import com.utils.MenuBarlyx;
|
||||
import com.utils.SetTablelyx;
|
||||
import com.utils.SetTablelyx;
|
||||
|
||||
public class CarViewlyx {
|
||||
JFrame main = new JFrame("Car Sale System");
|
||||
Container container = main.getContentPane();
|
||||
JButton buttonAdd, buttonDel, buttonChange, buttonReset;
|
||||
JTextField textFieldCarID, // 汽车ID
|
||||
textFieldModel, // 汽车型号
|
||||
textFieldColor, // 汽车颜色
|
||||
textFieldManuFactory, // 生产厂商
|
||||
textFieldFactoryDate, // 出厂日期
|
||||
textFieldPrice;// 价格
|
||||
JTable table;// 表格
|
||||
// 显示表格的滚动面板
|
||||
JScrollPane scrollPane;
|
||||
CarActionlyx carAction;
|
||||
|
||||
public CarViewlyx() {
|
||||
// TODO Auto-generated constructor stub
|
||||
main.setLayout(null);
|
||||
new BackgroundImagelyx(main, container, "CarBackground.jpg");
|
||||
new FrameOptionlyx(main);
|
||||
new MenuBarlyx(main);
|
||||
|
||||
// 实例化标签和文本框
|
||||
JLabel JLabelCarID = new JLabel("CarID");
|
||||
JLabelCarID.setForeground(Color.green);
|
||||
JLabelCarID.setBounds(75, 350, 100, 20);
|
||||
JTextField textFieldCarID = new JTextField();
|
||||
textFieldCarID.setBounds(175, 350, 100, 20);
|
||||
|
||||
|
||||
JLabel JLabelModel = new JLabel("Model");
|
||||
JLabelModel.setForeground(Color.green);
|
||||
JLabelModel.setBounds(350, 350, 100, 20);
|
||||
JTextField textFieldModel = new JTextField();
|
||||
textFieldModel.setBounds(450, 350, 100, 20);
|
||||
|
||||
JLabel JLabelColor = new JLabel("Color");
|
||||
JLabelColor.setForeground(Color.green);
|
||||
JLabelColor.setBounds(625, 350, 100, 20);
|
||||
JTextField textFieldColor = new JTextField();
|
||||
textFieldColor.setBounds(725, 350, 100, 20);
|
||||
|
||||
JLabel JLabelManuFactory = new JLabel("ManuFactory");
|
||||
JLabelManuFactory.setForeground(Color.green);
|
||||
JLabelManuFactory.setBounds(75, 400, 100, 20);
|
||||
JTextField textFieldManuFactory = new JTextField();
|
||||
textFieldManuFactory.setBounds(175, 400, 100, 20);
|
||||
|
||||
JLabel JLabelFactorydate = new JLabel("FactoryDate");
|
||||
JLabelFactorydate.setForeground(Color.green);
|
||||
JLabelFactorydate.setBounds(350, 400, 100, 20);
|
||||
JTextField textFieldFactoryDate = new JTextField();
|
||||
textFieldFactoryDate.setBounds(450, 400, 100, 20);
|
||||
|
||||
JLabel JLabelPrice = new JLabel("Price");
|
||||
JLabelPrice.setForeground(Color.green);
|
||||
JLabelPrice.setBounds(625, 400, 100, 20);
|
||||
JTextField textFieldPrice = new JTextField();
|
||||
textFieldPrice.setBounds(725, 400, 100, 20);
|
||||
|
||||
// 使文本框透明
|
||||
textFieldCarID.setOpaque(false);
|
||||
textFieldModel.setOpaque(false);
|
||||
textFieldColor.setOpaque(false);
|
||||
textFieldColor.setOpaque(false);
|
||||
textFieldManuFactory.setOpaque(false);
|
||||
textFieldFactoryDate.setOpaque(false);
|
||||
textFieldPrice.setOpaque(false);
|
||||
//修改输入字体颜色
|
||||
textFieldCarID.setForeground(new Color(19, 190, 196));
|
||||
textFieldModel.setForeground(new Color(19, 190, 196));
|
||||
textFieldColor.setForeground(new Color(19, 190, 196));
|
||||
textFieldManuFactory.setForeground(new Color(19, 190, 196));
|
||||
textFieldFactoryDate.setForeground(new Color(19, 190, 196));
|
||||
textFieldPrice.setForeground(new Color(19, 190, 196));
|
||||
|
||||
container.add(JLabelCarID);
|
||||
container.add(JLabelModel);
|
||||
container.add(JLabelColor);
|
||||
container.add(JLabelManuFactory);
|
||||
container.add(JLabelFactorydate);
|
||||
container.add(JLabelPrice);
|
||||
|
||||
container.add(textFieldCarID);
|
||||
container.add(textFieldModel);
|
||||
container.add(textFieldColor);
|
||||
container.add(textFieldManuFactory);
|
||||
container.add(textFieldFactoryDate);
|
||||
container.add(textFieldPrice);
|
||||
|
||||
// 实例化按钮
|
||||
buttonAdd = new JButton("Add");
|
||||
buttonAdd.setBounds(100, 480, 100, 20);
|
||||
buttonDel = new JButton("Delect");
|
||||
buttonDel.setBounds(300, 480, 100, 20);
|
||||
buttonChange = new JButton("Change");
|
||||
buttonChange.setBounds(500, 480, 100, 20);
|
||||
buttonReset = new JButton("Query");
|
||||
buttonReset.setBounds(700, 480, 100, 20);
|
||||
|
||||
//添加按钮
|
||||
container.add(buttonAdd);
|
||||
container.add(buttonDel);
|
||||
container.add(buttonChange);
|
||||
container.add(buttonReset);
|
||||
|
||||
carAction = new CarActionlyx();
|
||||
//初始化表格
|
||||
setTable();
|
||||
|
||||
//设置按钮监听
|
||||
//添加按钮
|
||||
buttonAdd.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
carAction.addCarInformation(textFieldCarID, textFieldModel, textFieldColor,
|
||||
textFieldManuFactory, textFieldFactoryDate, textFieldPrice);
|
||||
main.setVisible(false);
|
||||
new CarViewlyx();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
//删除按钮
|
||||
buttonDel.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
carAction.delCarInformation(Integer.parseInt(textFieldCarID.getText()));
|
||||
main.setVisible(false);
|
||||
new CarViewlyx();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
});
|
||||
//修改按钮
|
||||
buttonChange.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
try {
|
||||
carAction.changeCarInformation(textFieldCarID, textFieldModel, textFieldColor,
|
||||
textFieldManuFactory, textFieldFactoryDate, textFieldPrice);
|
||||
main.setVisible(false);
|
||||
new CarViewlyx();
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
JOptionPane.showMessageDialog(null,"表中没有该数据","错误"
|
||||
, JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
}
|
||||
});
|
||||
//查询按钮
|
||||
buttonReset.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
setTable();
|
||||
main.setVisible(false);
|
||||
new CarViewlyx();
|
||||
JOptionPane.showMessageDialog(null, "数据更新成功","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
} catch (Exception e1) {
|
||||
// TODO: handle exception
|
||||
JOptionPane.showMessageDialog(null, "数据更新失败","tips",JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void setTable() {
|
||||
// TODO Auto-generated method stub
|
||||
// 列名
|
||||
String[] columnNames = { "轿车编号", "型号", "颜色", "生产厂家", "出厂日期", "价格(元)" };
|
||||
try {
|
||||
CarActionlyx carAction = new CarActionlyx();
|
||||
Object[][] results = carAction.query(columnNames);
|
||||
|
||||
table = new JTable(results, columnNames);
|
||||
scrollPane = new JScrollPane(table);
|
||||
// 设置表格
|
||||
new SetTablelyx(scrollPane,table,columnNames,main);
|
||||
|
||||
table.addMouseListener(new MouseListener() {
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
// String car_id, model, color, manufactory, factory_date, price;
|
||||
//
|
||||
// int selRow = table.getSelectedRow();
|
||||
//
|
||||
// car_id = table.getValueAt(selRow, 0).toString();
|
||||
// model = table.getValueAt(selRow, 1).toString();
|
||||
// color = table.getValueAt(selRow, 2).toString();
|
||||
// manufactory = table.getValueAt(selRow, 3).toString();
|
||||
// factory_date = table.getValueAt(selRow, 4).toString();
|
||||
// price = table.getValueAt(selRow, 5).toString();
|
||||
|
||||
// textFieldCarID.setText(car_id);
|
||||
// textFieldModel.setText(model);
|
||||
// textFieldColor.setText(color);
|
||||
// textFieldManuFactory.setText(manufactory);
|
||||
// textFieldFactoryDate.setText(factory_date);
|
||||
// textFieldPrice.setText(price);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.entity;
|
||||
|
||||
public class Carlyx {
|
||||
private int car_id; // 轿车编号
|
||||
private String model; // 型号
|
||||
private String color; //颜色
|
||||
private String manufactory; // 生产厂家
|
||||
private String factory_date; // 出厂日期
|
||||
private String price;// 价格
|
||||
public int getCar_id() {
|
||||
return car_id;
|
||||
}
|
||||
public void setCar_id(int car_id) {
|
||||
this.car_id = car_id;
|
||||
}
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
public String getManufactory() {
|
||||
return manufactory;
|
||||
}
|
||||
public void setManufactory(String manufactory) {
|
||||
this.manufactory = manufactory;
|
||||
}
|
||||
public String getFactory_date() {
|
||||
return factory_date;
|
||||
}
|
||||
public void setFactory_date(String factory_date) {
|
||||
this.factory_date = factory_date;
|
||||
}
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
public void setPrice(String price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.utils;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class FrameOptionlyx {
|
||||
public FrameOptionlyx(JFrame main) {
|
||||
// TODO Auto-generated constructor stub
|
||||
main.setSize(900, 600);
|
||||
main.setLocationRelativeTo(null);
|
||||
main.setResizable(false);// 禁止修改窗口大小
|
||||
main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
main.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.main;
|
||||
|
||||
import com.view.Login;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Login lg =new Login();
|
||||
lg.loginGUi(null);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package com.utils;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.*;
|
||||
import com.view.*;
|
||||
|
||||
public class MenuBarlyx {
|
||||
JMenuBar menuBar;
|
||||
JMenuItem carInfomationItem;
|
||||
JMenuItem workerInformationItem;
|
||||
JMenuItem guestInformationItem;
|
||||
JMenuItem saleInformationItem;
|
||||
JMenuItem exitItem;
|
||||
|
||||
public MenuBarlyx(JFrame frame) {
|
||||
// TODO Auto-generated constructor stub
|
||||
menuBar = new JMenuBar();
|
||||
|
||||
carInfomationItem = new JMenuItem("汽车信息");
|
||||
carInfomationItem.setBackground(Color.black);
|
||||
carInfomationItem.setForeground(Color.green);
|
||||
setCarInfomationItem(frame);
|
||||
workerInformationItem = new JMenuItem("员工信息");
|
||||
workerInformationItem.setBackground(Color.black);
|
||||
workerInformationItem.setForeground(Color.green);
|
||||
setWorkerInformationItem(frame);
|
||||
guestInformationItem = new JMenuItem("客户信息");
|
||||
guestInformationItem.setBackground(Color.black);
|
||||
guestInformationItem.setForeground(Color.green);
|
||||
setGuestInformationItem(frame);
|
||||
saleInformationItem = new JMenuItem("销售信息");
|
||||
saleInformationItem.setBackground(Color.black);
|
||||
saleInformationItem.setForeground(Color.green);
|
||||
setSaleInformationItem(frame);
|
||||
exitItem = new JMenuItem("退出系统");
|
||||
exitItem.setBackground(Color.black);
|
||||
exitItem.setForeground(Color.red);
|
||||
setExitItem(frame);
|
||||
menuBar.add(carInfomationItem);
|
||||
menuBar.add(workerInformationItem);
|
||||
menuBar.add(guestInformationItem);
|
||||
menuBar.add(saleInformationItem);
|
||||
menuBar.add(exitItem);
|
||||
|
||||
frame.setJMenuBar(menuBar);
|
||||
|
||||
}
|
||||
|
||||
private void setCarInfomationItem(JFrame main) {
|
||||
// TODO Auto-generated method stub
|
||||
carInfomationItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
main.setVisible(false);
|
||||
new com.view.CarViewlyx();
|
||||
}
|
||||
});
|
||||
}
|
||||
private void setWorkerInformationItem(JFrame main) {
|
||||
// TODO Auto-generated method stub
|
||||
workerInformationItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
main.setVisible(false);
|
||||
new com.view.WorkerViewdyh();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setGuestInformationItem(JFrame main) {
|
||||
// TODO Auto-generated method stub
|
||||
guestInformationItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
main.setVisible(false);
|
||||
new com.view.GuestViewhxr();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
private void setSaleInformationItem(JFrame main) {
|
||||
// TODO Auto-generated method stub
|
||||
saleInformationItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
main.setVisible(false);
|
||||
new com.view.SaleViewyzz();
|
||||
}
|
||||
});
|
||||
}
|
||||
private void setExitItem(JFrame main) {
|
||||
// TODO Auto-generated method stub
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
main.setVisible(false);
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.utils;
|
||||
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
|
||||
public class SetScrollPanelyx {
|
||||
|
||||
public SetScrollPanelyx(JScrollPane scrollPane,JTable table) {
|
||||
// TODO Auto-generated method stub
|
||||
// 将JScrollPane设置为透明
|
||||
scrollPane.setOpaque(false);
|
||||
//将viewport设置为透明
|
||||
scrollPane.getViewport().setOpaque(false);
|
||||
//转载table
|
||||
scrollPane.setViewportView(table);
|
||||
//设置头部透明
|
||||
scrollPane.setColumnHeaderView(table.getTableHeader());
|
||||
scrollPane.getColumnHeader().setOpaque(false);
|
||||
// 设置滚动条位置
|
||||
scrollPane.setBounds(50, 50, 800, 250);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue