⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tabpaneframe.java

📁 用java写的固定资产管理系统原代码 这可是自己小组做的哦
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                            .add(buyDateText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(AssetPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(state)
                            .add(stateText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(userName)
                            .add(userNameText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel1))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, AssetPaneLayout.createSequentialGroup()
                        .addContainerGap()
                        .add(TextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(AssetPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(reset)
                            .add(del)
                            .add(change)
                            .add(add))))
                .addContainerGap())
        );
        tabPane.addTab("\u8d44\u4ea7\u5feb\u6377\u7ba1\u7406", AssetPane);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 616, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(tabPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void changeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeActionPerformed
// TODO 将在此处添加您的处理代码:        
        if(MainFrame.table.getSelectedRow() != -1) {
            if(nameText.getText().equalsIgnoreCase("") || sortText.getText().equalsIgnoreCase("") ||
                    modelText.getText().equalsIgnoreCase("") || stateText.getText().equalsIgnoreCase("") ||buyDateText.getText().equalsIgnoreCase("")){
                    JOptionPane.showMessageDialog(this,"请正确完整输入!!!","错误",JOptionPane.ERROR_MESSAGE);
                    return;
            }
            try {
                if(JOptionPane.showConfirmDialog(tabPaneFrame.this,"是否修改?","提示",JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
                    stmt = c.getConn().createStatement();
                    try {
                        stmt.executeUpdate("Update AssetInfo SET Name = '" + nameText.getText() + "',Sort = '" + sortText.getText() + "',Model = '" + modelText.getText() + "',Merit = " + priceText.getText() + ",BuyDate = '" + buyDateText.getText() + "',State = '" + stateText.getText() + " ',Remark = '" + remarkText.getText() + "' WHERE Code = '" + codeText.getText() + "'");
                    } catch(NumberFormatException ex) {
                        JOptionPane.showMessageDialog(this, "数据格式错误!请检查", "错误", JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    MainFrame.rm.setResult(c.getRs());
                    MainFrame.freshTree();
                    JOptionPane.showMessageDialog(tabPaneFrame.this,"该条记录修改成功!","提示",JOptionPane.INFORMATION_MESSAGE);
                    codeText.setText("");
                    nameText.setText("");
                    sortText.setText("");
                    priceText.setText("");
                    buyDateText.setText("");
                    userNameText.setText("");
                    remarkText.setText("");
                    modelText.setText("");
                    stateText.setText(""); 
                }
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        } else 
            JOptionPane.showMessageDialog(this,"请选择要修改的一项!","错误",JOptionPane.ERROR_MESSAGE);
    }//GEN-LAST:event_changeActionPerformed

    private void delActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_delActionPerformed
// TODO 将在此处添加您的处理代码:
        if(MainFrame.table.getSelectedRow() != -1) {
            try {
                if(JOptionPane.showConfirmDialog(tabPaneFrame.this,"是否删除?","提示",JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
                    stmt = c.getConn().createStatement();                    
                    stmt.executeUpdate("DELETE AssetInfo WHERE Code = '" + MainFrame.rm.getValueAt(MainFrame.table.getSelectedRow(),0) + "'");                    
                    MainFrame.rm.delData(MainFrame.table.getSelectedRow());
                    JOptionPane.showMessageDialog(tabPaneFrame.this,"删除成功!","提示",JOptionPane.INFORMATION_MESSAGE);
                    codeText.setText("");
                    nameText.setText("");
                    sortText.setText("");
                    priceText.setText("");
                    buyDateText.setText("");
                    userNameText.setText("");
                    remarkText.setText("");
                    modelText.setText("");
                    stateText.setText(""); 
                }
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        } else 
            JOptionPane.showMessageDialog(this,"请选择要删除的一项!","错误",JOptionPane.ERROR_MESSAGE);
    }//GEN-LAST:event_delActionPerformed

    private void resetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetActionPerformed
// TODO 将在此处添加您的处理代码:
        codeText.setText("");
        nameText.setText("");
        sortText.setText("");
        priceText.setText("");
        buyDateText.setText("");
        userNameText.setText("");
        remarkText.setText("");
        modelText.setText("");
        stateText.setText("");        
    }//GEN-LAST:event_resetActionPerformed

    private void addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addActionPerformed
// TODO 将在此处添加您的处理代码:
        String Name = nameText.getText();
        String sort = sortText.getText();
        String model = modelText.getText();
        sillClass sill = new sillClass();
        
        double merit=0;        
        
        String buydate = buyDateText.getText();
        String state = stateText.getText();
        String annotation = remarkText.getText();
        
        OpendatabaseClass open = new OpendatabaseClass(sill.getconnection().transmitConnection());
        if(Name.equalsIgnoreCase("") || sort.equalsIgnoreCase("") ||
                model.equalsIgnoreCase("") || state.equalsIgnoreCase("") ||buydate.equalsIgnoreCase("")){
            JOptionPane.showMessageDialog(this,"请正确完整输入!!!","错误",JOptionPane.ERROR_MESSAGE);
        }else{
            if(!codeText.getText().equalsIgnoreCase("")) {
                JOptionPane.showMessageDialog(this,"该编号已存在!请在确定一次!","错误",JOptionPane.ERROR_MESSAGE);
                codeText.setText("");
                return;
            }
            try{
                merit = Double.parseDouble(priceText.getText());
            }catch(NumberFormatException e){
                JOptionPane.showMessageDialog(this, "请正确输入设备价值,价值必须为数字!!!", "错误", JOptionPane.ERROR_MESSAGE);
                priceText.grabFocus();
                return;
            }
            try {
                open.accretion_record(Name,sort,model,merit,buydate,state,annotation);
                JOptionPane.showMessageDialog(this, "添加成功!感谢您的使用!!", "成功", JOptionPane.INFORMATION_MESSAGE);
                DatabaseConnection dbc = new DatabaseConnection();
                MainFrame.freshTree();
                MainFrame.rm.setResult(dbc.getRs());                
            } catch (SQLException ex) {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(this, ex.getMessage(), "错误", JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_addActionPerformed
 
    
    
    // 变量声明 - 不进行修改//GEN-BEGIN:variables
    private javax.swing.JPanel AssetPane;
    private javax.swing.JScrollPane TextField;
    private javax.swing.JButton add;
    private javax.swing.JLabel buyDate;
    public javax.swing.JTextField buyDateText;
    private javax.swing.JButton change;
    private javax.swing.JLabel code;
    public javax.swing.JTextField codeText;
    private javax.swing.JButton del;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel model;
    public javax.swing.JTextField modelText;
    private javax.swing.JLabel name;
    public javax.swing.JTextField nameText;
    private javax.swing.JLabel price;
    public javax.swing.JTextField priceText;
    private javax.swing.JLabel remark;
    public javax.swing.JTextArea remarkText;
    private javax.swing.JButton reset;
    private javax.swing.JLabel sort;
    public javax.swing.JTextField sortText;
    private javax.swing.JLabel state;
    public javax.swing.JTextField stateText;
    private javax.swing.JTabbedPane tabPane;
    private javax.swing.JLabel userName;
    public javax.swing.JTextField userNameText;
    // 变量声明结束//GEN-END:variables
    private Statement stmt;
    private DatabaseConnection c = new DatabaseConnection();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -