📄 add_workman_dialog.java
字号:
/*
* add_workman_Dialog.java
*
* Created on 2007年4月30日, 上午11:36
*
*此功能是用来添加能借用设备的职员记录
*/
package com.cn.szhaccp.set;
import com.cn.szhaccp.landing.ToCenter;
import com.cn.szhaccp.sill.*;
import java.sql.SQLException;
import javax.swing.JOptionPane;
/**
*
* @author Administrator
*/
public class add_workman_Dialog extends javax.swing.JDialog {
sillClass sill;
ToCenter tocenter;
/** Creates new form add_workman_Dialog */
public add_workman_Dialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
tocenter = new ToCenter();
tocenter.SetDialogToCenter(this);
}
public add_workman_Dialog(java.awt.Frame parent, boolean modal,sillClass sill){
this(parent,modal);
this.sill = sill;
}
/** 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() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
codetext = new javax.swing.JTextField();
nametext = new javax.swing.JTextField();
dutytext = new javax.swing.JTextField();
annotationtext = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("\u6dfb\u52a0\u804c\u5458");
jLabel1.setText("\u804c\u5458\u7f16\u53f7\uff1a");
jLabel2.setText("\u804c\u5458\u59d3\u540d\uff1a");
jLabel3.setText("\u804c\u5458\u804c\u52a1\uff1a");
jLabel4.setText("\u5907 \u6ce8\uff1a");
jButton1.setText("\u6dfb \u52a0");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("\u53d6 \u6d88");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(48, 48, 48)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel3)
.add(jLabel4))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(annotationtext, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)
.add(dutytext, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)))
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(nametext))
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(codetext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 147, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
.add(51, 51, 51))
.add(layout.createSequentialGroup()
.add(63, 63, 63)
.add(jButton1)
.add(38, 38, 38)
.add(jButton2)
.addContainerGap(71, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(28, 28, 28)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(codetext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(32, 32, 32)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(nametext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(37, 37, 37)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(dutytext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(32, 32, 32)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jLabel4)
.add(annotationtext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(31, 31, 31)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton1)
.add(jButton2))
.addContainerGap(31, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
this.dispose();
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
add();
}//GEN-LAST:event_jButton1ActionPerformed
public void add(){
String code = codetext.getText();
String name = nametext.getText();
String duty = dutytext.getText();
String annotation = annotationtext.getText();
OpendatabaseClass open = new OpendatabaseClass(sill.getconnection().transmitConnection());
if(code.equalsIgnoreCase("") || name.equalsIgnoreCase("") || duty.equalsIgnoreCase("")){
JOptionPane.showMessageDialog(this,"请正确完整输入!!!","错误提示",JOptionPane.ERROR_MESSAGE);
}else{
try {
open.add_workman(code,name,duty,annotation);
JOptionPane.showMessageDialog(this, "添加成功!感谢您的使用!!", "添加提示", JOptionPane.INFORMATION_MESSAGE);
DatabaseConnection dbc = new DatabaseConnection();
MainFrame.rm.setResult(dbc.getRs());
this.dispose();
} catch (SQLException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this, ex.getMessage(), "错误提示", JOptionPane.ERROR_MESSAGE);
}
}
}
// 变量声明 - 不进行修改//GEN-BEGIN:variables
private javax.swing.JTextField annotationtext;
private javax.swing.JTextField codetext;
private javax.swing.JTextField dutytext;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField nametext;
// 变量声明结束//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -