Records.java
上传用户:xinkaifrp
上传日期:2021-05-08
资源大小:372k
文件大小:3k
源码类别:

家庭/个人应用

开发平台:

Java

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. /*
  6.  * Records.java
  7.  *
  8.  * Created on 2009-6-25, 15:50:02
  9.  */
  10. package com.financing;
  11. import com.financing.dao.RecordDao;
  12. /**
  13.  *
  14.  * @author Administrator
  15.  */
  16. public class Records extends javax.swing.JFrame {
  17.     private Integer userId;
  18.     public void setUserId(Integer userId) {
  19.         this.userId = userId;
  20.     }
  21.     
  22.     /** Creates new form Records */
  23.     public Records() {
  24.         initComponents();
  25.         this.setLocation(300, 200);
  26.        
  27.     }
  28.    public void setTalbeModel(){
  29.         jTable1.setModel(new RecordDao().getUserRecord(userId));
  30.    }
  31.     @SuppressWarnings("unchecked")
  32.     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  33.     private void initComponents() {
  34.         jScrollPane1 = new javax.swing.JScrollPane();
  35.         jTable1 = new javax.swing.JTable();
  36.         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  37.         jTable1.setModel(new javax.swing.table.DefaultTableModel(
  38.             new Object [][] {
  39.                 {null, null, null, null},
  40.                 {null, null, null, null}
  41.             },
  42.             new String [] {
  43.                 "Title 1", "Title 2", "Title 3", "Title 4"
  44.             }
  45.         ) {
  46.             boolean[] canEdit = new boolean [] {
  47.                 false, false, false, false
  48.             };
  49.             public boolean isCellEditable(int rowIndex, int columnIndex) {
  50.                 return canEdit [columnIndex];
  51.             }
  52.         });
  53.         jScrollPane1.setViewportView(jTable1);
  54.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  55.         getContentPane().setLayout(layout);
  56.         layout.setHorizontalGroup(
  57.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  58.             .addGroup(layout.createSequentialGroup()
  59.                 .addContainerGap()
  60.                 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE)
  61.                 .addContainerGap())
  62.         );
  63.         layout.setVerticalGroup(
  64.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  65.             .addGroup(layout.createSequentialGroup()
  66.                 .addContainerGap()
  67.                 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 301, javax.swing.GroupLayout.PREFERRED_SIZE)
  68.                 .addContainerGap(99, Short.MAX_VALUE))
  69.         );
  70.         pack();
  71.     }// </editor-fold>//GEN-END:initComponents
  72.    
  73.     // Variables declaration - do not modify//GEN-BEGIN:variables
  74.     private javax.swing.JScrollPane jScrollPane1;
  75.     private javax.swing.JTable jTable1;
  76.     // End of variables declaration//GEN-END:variables
  77. }