📄 duserhz.java~2~
字号:
package jxm;
import java.awt.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.*;
import java.util.Vector;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Duserhz extends JDialog {
JPanel panel1 = new JPanel();
JScrollPane jScrollPane1 = new JScrollPane();
DefaultTableModel df = new DefaultTableModel();
JTable jTable1 = new JTable(df);
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
public Duserhz(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
pack();
} catch (Exception exception) {
exception.printStackTrace();
}
}
public Duserhz() {
this(new Frame(), "Duserhz", false);
}
private void jbInit() throws Exception {
panel1.setLayout(null);
jScrollPane1.setBounds(new Rectangle(10, 8, 491, 309));
this.getContentPane().setLayout(null);
panel1.setBounds(new Rectangle(4, 10, 512, 371));
this.getContentPane().add(panel1, null);
jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 12));
jLabel1.setForeground(Color.red);
jLabel1.setText("用户总数");
jLabel1.setBounds(new Rectangle(314, 321, 60, 27));
jLabel2.setBorder(BorderFactory.createEtchedBorder());
jLabel2.setBounds(new Rectangle(375, 319, 62, 28));
panel1.add(jLabel2);
panel1.add(jLabel1);
panel1.add(jScrollPane1, null);
jScrollPane1.getViewport().add(jTable1);
df.addColumn("读者编号");
df.addColumn("读者姓名");
df.addColumn("性别");
df.addColumn("联系电话");
df.addColumn("地址");
dispaly();
}
public Vector getv(jbuser j) {
Vector ve = new Vector();
ve.add(j.getDnum());
ve.add(j.getDname());
ve.add(j.getDsex());
ve.add(j.getDdh());
ve.add(j.getDaddress());
return ve;
}
public void dispaly() {
cons con = new cons();
Vector ve = con.getuserve("select * from duze");
jbuser j;
int s=0;
for (int i = 0; i < ve.size(); i++) {
j = (jbuser) ve.get(i);
df.addRow(getv(j));
s++;
}
jLabel2.setText(s+"");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -