📄 querycustomerwin.java
字号:
package org.itstar.netbar.swing;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import org.itstar.netbar.bean.CustomerBean;
import org.itstar.netbar.domain.ICustomerDomain;
import org.itstar.netbar.domain.impl.CustomerDomainImpl;
import java.awt.Rectangle;
public class QueryCustomerWin {
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="10,10"
private JScrollPane jScrollPane = null;
private JTable jTable = null;
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJTable());
}
return jScrollPane;
}
private TableModel getTableModel()
{
CustomerBean cBean=new CustomerBean();
ICustomerDomain cDomain=new CustomerDomainImpl();
List list=new ArrayList();
list=cDomain.queryAll();
Iterator it=list.iterator();
Object[] columnName={"会员卡号","卡号密码","卡上金额(元)","会员姓名","身份证号","注册日期","卡号状态","上次登录"};
Object[][] cells=new Object[list.size()][8];
int i=0;
while(it.hasNext())
{
cBean=(CustomerBean)it.next();
cells[i][0]=cBean.getCusCardNum();
cells[i][1]=cBean.getCusCardPassword();
cells[i][2]=cBean.getCusBalance();
cells[i][3]=cBean.getCusName();
cells[i][4]=cBean.getCusPersonID();
cells[i][5]=cBean.getCusRegDate();
cells[i][6]=cBean.getCusCardState();
cells[i][7]=cBean.getCusLastLoginTime();
i++;
}
TableModel tableModel=new DefaultTableModel(cells,columnName);
return tableModel;
}
/**
* This method initializes jTable
*
* @return javax.swing.JTable
*/
private JTable getJTable() {
if (jTable == null) {
jTable = new JTable(getTableModel());
}
return jTable;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
SwingUtilities.invokeLater(new Runnable() {
public void run() {
QueryCustomerWin application = new QueryCustomerWin();
application.getJFrame().setVisible(true);
}
});
}
/**
* This method initializes jFrame
*
* @return javax.swing.JFrame
*/
public JFrame getJFrame() {
if (jFrame == null) {
jFrame = new JFrame();
jFrame.setAlwaysOnTop(true);
jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
jFrame.setBounds(new Rectangle(100, 120, 843, 538));
jFrame.setPreferredSize(new Dimension(500, 450));
jFrame.setContentPane(getJScrollPane());
jFrame.setTitle("会员信息");
}
return jFrame;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -