📄 goodsregister.java
字号:
package purchase;
import javax.swing.JPanel;
import javax.swing.JDialog;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JButton;
import main.DataBase;
import java.awt.Font;
import purchase.Purchase;
class GoodsRegister extends JDialog {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JTextField time = null;
private JButton ok = null;
//contractNum用来记录所选择的合同的编号
private String contractNum;
/**
* @param owner
*/
public GoodsRegister(String contractNum) {
super(Purchase.frame,true);
this.contractNum=contractNum;
initialize();
this.setLocation(250,250);
this.setVisible(true);
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 200);
this.setTitle("到货登记");
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(12, 52, 85, 27));
jLabel.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel.setText("到货时间");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(getTime(), null);
jContentPane.add(getOk(), null);
}
return jContentPane;
}
/**
* This method initializes time
*
* @return javax.swing.JTextField
*/
private JTextField getTime() {
if (time == null) {
time = new JTextField();
time.setBounds(new Rectangle(127, 52, 141, 27));
time.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return time;
}
/**
* This method initializes ok
*
* @return javax.swing.JButton
*/
private JButton getOk() {
if (ok == null) {
ok = new JButton();
ok.setBounds(new Rectangle(127, 108, 83, 32));
ok.setText("确认");
ok.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
ok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if(!GoodsRegister.this.getTime().getText().equals("")){
DataBase.execute("update contract set real_deal_time=" +GoodsRegister.
this.getTime().getText()+
"where contract_num='"+GoodsRegister.this.contractNum+"'");
javax.swing.JOptionPane.showMessageDialog(null,"图书馆管理系统\n"+
"到货记录添加成功!!! \n");
Contract.setModelForTable();
}
}
});
}
return ok;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -