📄 txlframe.java
字号:
package addressBook;
/*
* txlFrame.java
*
* Created on 2002年6月3日, 上午10:52
*/
import java.util.*;
/**
*
* @author Administrator
*/
public class txlFrame extends javax.swing.JFrame {
private DBQuery dbQuery=new DBQuery();
private ArrayList peopleList=new ArrayList();
private Person p=new Person();
/** Creates new form txlFrame */
public txlFrame() {
initComponents();
peopleList=dbQuery.getPeople();
String name;
String zip;
String address;
String telephone;
String cellphone;
String email;
for(int i=0;i<5;i++){
if(i<peopleList.size()){
p=(Person)peopleList.get(i);
name=p.getName();
zip=p.getZip();
address=p.getAddress();
telephone=p.getTelephone();
cellphone=p.getCellphone();
email=p.getEmail();
jTable1.setValueAt(name,i,0);
jTable1.setValueAt(zip,i,1);
jTable1.setValueAt(address,i,2);
jTable1.setValueAt(telephone,i,3);
jTable1.setValueAt(cellphone,i,4);
jTable1.setValueAt(email,i,5);
}
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null}
},
new String [] {
"姓名", "邮政编码", "通信地址", "电话", "手机", "电子邮件"
}
));
jScrollPane1.setViewportView(jTable1);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new txlFrame().setVisible(true);
}
});
}
// 变量声明 - 不进行修改//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// 变量声明结束//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -