?? buy.java
字號(hào):
package purchase;
import javax.swing.JPanel;
import java.awt.Frame;
import javax.swing.JDialog;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JButton;
import java.awt.Font;
import javax.swing.JTextField;
import main.DataBase;
class Buy extends JDialog {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JButton confirm = null;
private JTextField isbn = null;
private JTextField book_name = null;
private JTextField author = null;
private JTextField press = null;
private JTextField book_store = null;
private String[] value;
private JLabel jLabel5 = null;
private JLabel jLabel6 = null;
private JLabel jLabel7 = null;
private JLabel jLabel8 = null;
private JTextField contract_num = null;
private JTextField quantity = null;
private JTextField sumvalue = null;
private JTextField should_deal_time = null;
/**
* @param owner
*/
public Buy(Frame owner,String[] info) {
super(owner,true);
this.value=info;
initialize();
this.setLocation(250,250);
this.setVisible(true);
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(618, 349);
this.setTitle("訂書(shū)對(duì)話框");
this.setContentPane(getJContentPane());
//傳入值
this.getIsbn().setText(this.value[0]);
this.getBook_name().setText(this.value[1]);
this.getAuthor().setText(this.value[2]);
this.getPress().setText(this.value[3]);
//設(shè)定不可編輯
this.getIsbn().setEditable(false);
this.getBook_name().setEditable(false);
this.getAuthor().setEditable(false);
this.getPress().setEditable(false);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel8 = new JLabel();
jLabel8.setBounds(new Rectangle(320, 170, 114, 30));
jLabel8.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel8.setText("計(jì)劃到貨時(shí)間");
jLabel7 = new JLabel();
jLabel7.setBounds(new Rectangle(320, 116, 104, 29));
jLabel7.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel7.setText("總額");
jLabel6 = new JLabel();
jLabel6.setBounds(new Rectangle(320, 61, 100, 30));
jLabel6.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel6.setText("數(shù)量");
jLabel5 = new JLabel();
jLabel5.setBounds(new Rectangle(320, 9, 96, 28));
jLabel5.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel5.setText("合同號(hào)");
jLabel4 = new JLabel();
jLabel4.setBounds(new Rectangle(13, 228, 92, 32));
jLabel4.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel4.setText("書(shū)商");
jLabel3 = new JLabel();
jLabel3.setBounds(new Rectangle(13, 170, 92, 33));
jLabel3.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel3.setText("出版社");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(13, 116, 92, 29));
jLabel2.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel2.setText("作者");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(13, 64, 92, 29));
jLabel1.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel1.setText("書(shū)名");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(13, 9, 92, 28));
jLabel.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
jLabel.setText("ISBN");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(jLabel1, null);
jContentPane.add(jLabel2, null);
jContentPane.add(jLabel3, null);
jContentPane.add(jLabel4, null);
jContentPane.add(getConfirm(), null);
jContentPane.add(getIsbn(), null);
jContentPane.add(getBook_name(), null);
jContentPane.add(getAuthor(), null);
jContentPane.add(getPress(), null);
jContentPane.add(getBook_store(), null);
jContentPane.add(jLabel5, null);
jContentPane.add(jLabel6, null);
jContentPane.add(jLabel7, null);
jContentPane.add(jLabel8, null);
jContentPane.add(getContract_num(), null);
jContentPane.add(getQuantity(), null);
jContentPane.add(getSumvalue(), null);
jContentPane.add(getShould_deal_time(), null);
}
return jContentPane;
}
/**
* This method initializes confirm
*
* @return javax.swing.JButton
*/
private JButton getConfirm() {
if (confirm == null) {
confirm = new JButton();
confirm.setBounds(new Rectangle(13, 275, 99, 36));
confirm.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
confirm.setText("提交");
confirm.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//獲取合同信息
String bookStore=Buy.this.getBook_store().getText();
String contractnum=Buy.this.getContract_num().getText();
String quantity=Buy.this.getQuantity().getText();
String sumValue=Buy.this.getSumvalue().getText();
String author=Buy.this.getAuthor().getText();
String should_deal_time=Buy.this.
getShould_deal_time().getText();
String sql="insert into contract(contract_num,book_store,isbn," +
"quantity,book_value,should_deal_time,book_name,real_deal_time," +
"store_or_not,author,press)" +
"values('"+contractnum+"','"+bookStore+"','"+Buy.this.value[0]+"',"
+quantity+","+sumValue+","
+should_deal_time+",'"+Buy.this.value[1]+"',0,0,'"+author+"','"+
Buy.this.getPress().getText()+"')";
//System.out.println(sql);
DataBase.execute(sql);
javax.swing.JOptionPane.showMessageDialog(null,"圖書(shū)館管理系統(tǒng)\n"+
"合同提交成功 \n");
DataBase.execute("DELETE FROM [library].[dbo].[lack_book]"+
" WHERE isbn='"+Buy.this.value[0]+"'");
LackBook.setModelForTable();
Contract.setModelForTable();
}
});
}
return confirm;
}
/**
* This method initializes isbn
*
* @return javax.swing.JTextField
*/
private JTextField getIsbn() {
if (isbn == null) {
isbn = new JTextField();
isbn.setBounds(new Rectangle(122, 9, 162, 28));
isbn.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return isbn;
}
/**
* This method initializes book_name
*
* @return javax.swing.JTextField
*/
private JTextField getBook_name() {
if (book_name == null) {
book_name = new JTextField();
book_name.setBounds(new Rectangle(122, 64, 162, 29));
book_name.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return book_name;
}
/**
* This method initializes author
*
* @return javax.swing.JTextField
*/
private JTextField getAuthor() {
if (author == null) {
author = new JTextField();
author.setBounds(new Rectangle(122, 116, 162, 29));
author.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return author;
}
/**
* This method initializes press
*
* @return javax.swing.JTextField
*/
private JTextField getPress() {
if (press == null) {
press = new JTextField();
press.setBounds(new Rectangle(122, 170, 162, 33));
press.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return press;
}
/**
* This method initializes book_store
*
* @return javax.swing.JTextField
*/
private JTextField getBook_store() {
if (book_store == null) {
book_store = new JTextField();
book_store.setBounds(new Rectangle(122, 228, 162, 32));
book_store.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return book_store;
}
/**
* This method initializes contract_num
*
* @return javax.swing.JTextField
*/
private JTextField getContract_num() {
if (contract_num == null) {
contract_num = new JTextField();
contract_num.setBounds(new Rectangle(453, 9, 145, 28));
contract_num.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return contract_num;
}
/**
* This method initializes quantity
*
* @return javax.swing.JTextField
*/
private JTextField getQuantity() {
if (quantity == null) {
quantity = new JTextField();
quantity.setBounds(new Rectangle(453, 61, 145, 30));
quantity.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return quantity;
}
/**
* This method initializes sumvalue
*
* @return javax.swing.JTextField
*/
private JTextField getSumvalue() {
if (sumvalue == null) {
sumvalue = new JTextField();
sumvalue.setBounds(new Rectangle(453, 116, 145, 29));
sumvalue.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return sumvalue;
}
/**
* This method initializes should_deal_time
*
* @return javax.swing.JTextField
*/
private JTextField getShould_deal_time() {
if (should_deal_time == null) {
should_deal_time = new JTextField();
should_deal_time.setBounds(new Rectangle(453, 170, 145, 30));
should_deal_time.setFont(new Font("\u6977\u4f53_GB2312", Font.BOLD, 18));
}
return should_deal_time;
}
} // @jve:decl-index=0:visual-constraint="10,10"
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -