From af885fcb6d4463e730f13570a88cb7437ec7b805 Mon Sep 17 00:00:00 2001 From: nxist2202005087 <2543602068@qq.com> Date: Tue, 25 Jun 2024 01:10:33 +0800 Subject: [PATCH] ADD file via upload --- ProductListFrame.java | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 ProductListFrame.java diff --git a/ProductListFrame.java b/ProductListFrame.java new file mode 100644 index 0000000..062b9e3 --- /dev/null +++ b/ProductListFrame.java @@ -0,0 +1,51 @@ +package wuziqiyem; + +import JavaBean.zhanjicxs; +import JavaDao.zhanjiDaocxs; +import JavaDaoimple.zhanjicxsimple; + +import javax.swing.*; +import javax.swing.table.TableModel; +import java.awt.*; +import java.util.List; + +public class ProductListFrame extends MyFrame { + private JTable table; + private List zhanjicxs = null; + private zhanjiDaocxs zhanjiDaocxs = new zhanjicxsimple(); + + + private JLabel lblid; + private JLabel lbluserid; + private JLabel lblTime; + + + public ProductListFrame() { + super("历史战绩", 1000, 700); + zhanjicxs = zhanjiDaocxs.findAll(); + JPanel topPanel=new JPanel(); + FlowLayout f1_topPanel=(FlowLayout) topPanel.getLayout(); + f1_topPanel.setVgap(10); + f1_topPanel.setVgap(20); + JScrollPane jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getTable()); + getContentPane().add(jScrollPane, BorderLayout.CENTER); + } + private JTable getTable() { + TableModel model = new ProductTableModle(this.zhanjicxs); + if (table == null) { + table = new JTable(model); + table.setFont(new Font("微软雅黑", Font.PLAIN, 16)); + table.getTableHeader().setFont(new Font("微软雅黑", Font.BOLD, 16)); + table.setRowHeight(51); + + table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // 修正类型不匹配 + ListSelectionModel rowSelectionModel = table.getSelectionModel(); + } + return table; + } + + +} + +