📄 selectcurrentassetsframe.java
字号:
/*
* SelectCurrentAssetsFrame.java
*
* Created on 2007年6月20日, 上午5:29
*/
package frames;
import java.text.ParseException;
import java.util.*;
import javax.swing.*;
import module.*;
import helper.*;
import java.text.DateFormat;
import minco.*;
/**
*
* @author mj
*/
public class SelectCurrentAssetsFrame extends javax.swing.JInternalFrame {
/** Creates new form SelectCurrentAssetsFrame */
public SelectCurrentAssetsFrame() {
initComponents();
}
/** 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();
jScrollPane2 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel1 = new javax.swing.JPanel();
TSTextField = new javax.swing.JTextField();
showButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setClosable(true);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setIconifiable(true);
setMaximizable(true);
setTitle("\u6d41\u52a8\u8d44\u4ea7\u67e5\u8be2");
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"日期", "货币资金", "短期投资", "预付款、定金", "存货", "可回收税款"
}
) {
Class[] types = new Class [] {
java.lang.Object.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane2.setViewportView(jTable1);
jScrollPane1.setViewportView(jScrollPane2);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "\u6309\u65e5\u671f\u67e5\u8be2(\u7a7a\u4e3a\u663e\u793a\u5168\u90e8\u8bb0\u5f55):"));
showButton.setText("\u67e5\u8be2");
showButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
showButtonActionPerformed(evt);
}
});
jLabel1.setText("\u65e5\u671f:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
.addComponent(TSTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(17, 17, 17)
.addComponent(showButton, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(25, 25, 25))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(showButton)
.addComponent(TSTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 516, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(105, 105, 105)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(25, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(36, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void showButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showButtonActionPerformed
/* jTable1.getTableHeader().setReorderingAllowed(false);
jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
TableHelper.clearTable(jTable1);
//获取部门信息
CurrentAssetsAccess da = new CurrentAssetsAccess(Resource.getDBResource());
ArrayList<CurrentAssets> dis = da.getAllCurrentAssets();
for(CurrentAssets di : dis)
{
Object[] objs = new Object[]
{
di.getAssetTime(),
di.getCash(),
di.getShortTermInvestments(),
di.getPrepayments(),
di.getInventories(),
di.getTaxRecoverable()
};
TableHelper.addToTable(jTable1, objs);
}*/
//设置Table格式
jTable1.getTableHeader().setReorderingAllowed(false);
jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
TableHelper.clearTable(jTable1);
//获取部门信息
CurrentAssetsAccess da = new CurrentAssetsAccess(Resource.getDBResource());
if(TSTextField.getText().equals("")){
ArrayList<CurrentAssets> dis = da.getAllCurrentAssets();
for(CurrentAssets di : dis)
{
Object[] objs = new Object[]
{
di.getAssetTime(),
di.getCash(),
di.getShortTermInvestments(),
di.getPrepayments(),
di.getInventories(),
di.getTaxRecoverable()
};
TableHelper.addToTable(jTable1, objs);
}
}else{
String[] str= TSTextField.getText().split("-");
int i1,i2,i3;
i1=Integer.parseInt(str[0]);
i2=Integer.parseInt(str[1]);
i3=Integer.parseInt(str[2]);
i1-=1900;
i2--;
java.sql.Date date=new java.sql.Date(i1,i2,i3);
CurrentAssets di=da.getCurrentAssetsByTime(date);
Object[] objs = new Object[]
{
di.getAssetTime(),
di.getCash(),
di.getShortTermInvestments(),
di.getPrepayments(),
di.getInventories(),
di.getTaxRecoverable()
};
TableHelper.addToTable(jTable1, objs);
}
// TODO 将在此处添加您的处理代码:
}//GEN-LAST:event_showButtonActionPerformed
// 变量声明 - 不进行修改//GEN-BEGIN:variables
private javax.swing.JTextField TSTextField;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable jTable1;
private javax.swing.JButton showButton;
// 变量声明结束//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -