?? returnorderpayframe.java~55~
字號:
package stockinterface;import java.awt.*;import java.awt.event.*;import javax.swing.event.*;import javax.swing.*;import data.*;import maininterface.*;import user.*;import method.*;import java.util.Date;import print.*;public class ReturnOrderPayFrame extends JFrame implements ActionListener { JPanel contentPane; //創建標簽控件 JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JLabel jLabel4 = new JLabel(); JLabel jLabel5 = new JLabel(); JLabel jLabel6 = new JLabel(); JLabel jLabel7 = new JLabel(); JLabel jLabel8 = new JLabel(); JLabel jLabel9 = new JLabel(); JLabel jLabel10 = new JLabel(); JLabel jLabel11 = new JLabel(); JLabel jLabel12 = new JLabel(); JLabel jLabel13 = new JLabel(); JLabel jLabel14 = new JLabel(); JLabel jLabel15 = new JLabel(); JLabel jLabel16 = new JLabel(); JLabel jLabel17 = new JLabel(); JLabel jLabel18 = new JLabel(); JLabel jLabel19 = new JLabel(); JLabel jLabel20 = new JLabel(); //創建編輯框控件 JTextField jTextField1 = new JTextField(); JTextField jTextField2 = new JTextField(); JTextField jTextField3 = new JTextField(); JTextField jTextField4 = new JTextField(); JTextField jTextField5 = new JTextField(); JTextField jTextField6 = new JTextField(); JTextField jTextField7 = new JTextField(); JTextField jTextField8 = new JTextField(); JTextField jTextField9 = new JTextField(); JTextField jTextField10 = new JTextField(); JTextField jTextField11 = new JTextField(); JTextField jTextField12 = new JTextField(); JTextField jTextField13 = new JTextField(); JTextField jTextField14 = new JTextField(); JTextField jTextField15 = new JTextField(); //創建按鈕控件 JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JButton jButton3 = new JButton(); JButton jButton4 = new JButton(); JButton jButton5 = new JButton(); JButton jButton6 = new JButton(); //創建滾動框控件 JScrollPane jScrollPane1 = new JScrollPane(); JScrollPane jScrollPane2 = new JScrollPane(); JScrollPane jScrollPane3 = new JScrollPane(); //創建單選項控件 JRadioButton jRadioButton1 = new JRadioButton(); JRadioButton jRadioButton2 = new JRadioButton(); ButtonGroup buttonGroup1 = new ButtonGroup(); //創建列表框數據類和列表框控件 DefaultListModel listData1 = new DefaultListModel(); JList jList1 = new JList(listData1); //創建表格控件 JTable jTable1 = new JTable(); //創建表格模式類 StockSubLedgerTableModel sslTableModel = new StockSubLedgerTableModel(); //創建標題數組 String[] colNames = {"明細編號", "單據編號", "商品條形碼", "退貨價", "數量", "金額", "有效期"}; //創建下拉列表框控件 JComboBox jComboBox1 = new JComboBox(); //創建文本框控件 JTextArea jTextArea1 = new JTextArea(); //創建字體類 Font dialog13 = new java.awt.Font("Dialog", 0, 13); //聲明數據類 StockManagementData stockManagementData = null; //聲明用戶類 User user = null; //聲明主窗口類 StockManagementMainFrame stockManagementMainFrame = null; //創建庫存賬套數組 String[][] stockLedgers = new String[0][13]; //創建庫存賬套明細數組 String[][] stockSubLedgers = new String[0][6]; //創建庫存賬套明細表格數組 Object[][] stockSubLedgerObjects = new Object[0][7]; //創建方法類 DataMethod dataMethod = new DataMethod(); //創建動作字符串 String action = ""; //創建完成狀態數組 String[] onProcesses = {"進行", "撤消", "完成"}; //創建帳套日期字符串 String ledgerDate = ""; //聲明退貨單打印窗口 OrderPrintFrame returnOrderPrintFrame = null; //聲明應付票據打印窗口 OrderPayCheckPrintFrame orderPayCheckPrintFrame = null; public ReturnOrderPayFrame(StockManagementMainFrame stockManagementMainFrame) { this.stockManagementMainFrame = stockManagementMainFrame; //取得主窗口的數據類 stockManagementData = stockManagementMainFrame.getStockManagementData(); //取得主窗口的用戶類 user = stockManagementMainFrame.getUser(); //取得主窗口的賬套日期 ledgerDate = stockManagementMainFrame.getLedgerDate(); //取得退貨模塊的用戶權限 int stockFunction = user.getStockFunction(); //檢查用戶權限 if ( (stockFunction & 8) != 8) { JOptionPane.showMessageDialog(null, user.getUserName() + "用戶不具有該權限."); System.exit(0); } //檢查賬套日期 if(ledgerDate.length() == 0){ JOptionPane.showMessageDialog(null, user.getUserName() + "請選擇賬套."); return; } try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(null); this.setSize(new Dimension(667, 651)); this.setTitle("收取退款窗口"); //設置標簽的屬性 jLabel1.setText("退貨單列表"); jLabel1.setBounds(new Rectangle(28, 19, 85, 16)); jLabel2.setText("查詢條件"); jLabel2.setBounds(new Rectangle(192, 45, 62, 16)); jLabel3.setText("查詢值"); jLabel3.setBounds(new Rectangle(440, 45, 50, 16)); jLabel4.setText("開始日期"); jLabel4.setBounds(new Rectangle(192, 76, 67, 16)); jLabel5.setText("結束日期"); jLabel5.setBounds(new Rectangle(373, 76, 66, 16)); jLabel6.setText("單據編號"); jLabel6.setBounds(new Rectangle(192, 107, 66, 16)); jLabel7.setText("供應商"); jLabel7.setBounds(new Rectangle(427, 107, 54, 16)); jLabel8.setText("退貨地址"); jLabel8.setBounds(new Rectangle(192, 138, 66, 16)); jLabel9.setText("倉庫名字"); jLabel9.setBounds(new Rectangle(192, 170, 66, 16)); jLabel10.setText("退貨單日期"); jLabel10.setBounds(new Rectangle(192, 201, 66, 16)); jLabel11.setText("退貨日期"); jLabel11.setBounds(new Rectangle(192, 232, 66, 16)); jLabel12.setText("完成狀態"); jLabel12.setBounds(new Rectangle(192, 263, 66, 16)); jLabel13.setText("備注"); jLabel13.setBounds(new Rectangle(427, 170, 66, 16)); jLabel14.setText("退貨單明細列表"); jLabel14.setBounds(new Rectangle(28, 346, 110, 16)); jLabel15.setText("總價"); jLabel15.setBounds(new Rectangle(477, 346, 63, 16)); jLabel16.setText("請購員"); jLabel16.setBounds(new Rectangle(28, 556, 50, 16)); jLabel17.setText("訂購員"); jLabel17.setBounds(new Rectangle(173, 556, 51, 16)); jLabel18.setText("檢收員"); jLabel18.setBounds(new Rectangle(320, 556, 52, 16)); jLabel19.setText("現金管理員"); jLabel19.setBounds(new Rectangle(468, 556, 72, 16)); jLabel20.setText("供應商"); jLabel20.setBounds(new Rectangle(426, 267, 53, 16)); //設置編輯框的屬性 jTextField1.setBounds(new Rectangle(492, 45, 133, 22)); jTextField2.setBounds(new Rectangle(267, 76, 101, 22)); jTextField3.setBounds(new Rectangle(439, 76, 101, 22)); jTextField4.setEditable(false); jTextField4.setBounds(new Rectangle(267, 107, 147, 22)); jTextField5.setEditable(false); jTextField5.setBounds(new Rectangle(480, 107, 145, 22)); jTextField6.setEditable(false); jTextField6.setBounds(new Rectangle(267, 138, 358, 22)); jTextField7.setEditable(false); jTextField7.setBounds(new Rectangle(267, 170, 147, 22)); jTextField8.setEditable(false); jTextField8.setBounds(new Rectangle(267, 201, 147, 22)); jTextField9.setEditable(false); jTextField9.setBounds(new Rectangle(267, 232, 147, 22)); jTextField10.setEditable(false); jTextField10.setBounds(new Rectangle(267, 263, 147, 22)); jTextField11.setEditable(false); jTextField11.setBounds(new Rectangle(534, 346, 91, 22)); jTextField12.setEditable(false); jTextField12.setBounds(new Rectangle(76, 556, 85, 22)); jTextField13.setEditable(false); jTextField13.setBounds(new Rectangle(221, 556, 85, 22)); jTextField14.setEditable(false); jTextField14.setBounds(new Rectangle(370, 556, 85, 22)); jTextField15.setEditable(false); jTextField15.setBounds(new Rectangle(540, 556, 85, 22)); //設置按鈕的屬性 jButton1.setText("查詢"); jButton1.setActionCommand("search"); jButton1.setBounds(new Rectangle(546, 76, 79, 22)); jButton2.setText("電子簽名"); jButton2.setActionCommand("sign"); jButton2.setBounds(new Rectangle(28, 305, 118, 25)); jButton3.setText("撤消"); jButton3.setActionCommand("cancel"); jButton3.setBounds(new Rectangle(178, 305, 84, 25)); jButton4.setText("恢復"); jButton4.setActionCommand("restore"); jButton4.setBounds(new Rectangle(294, 305, 84, 25)); jButton5.setText("打印退貨單"); jButton5.setActionCommand("printOrder"); jButton5.setBounds(new Rectangle(410, 305, 99, 25)); jButton6.setText("退出"); jButton6.setActionCommand("exit"); jButton6.setBounds(new Rectangle(541, 305, 84, 25)); //設置滾動框的屬性 jScrollPane1.setBounds(new Rectangle(28, 45, 151, 240)); jScrollPane2.setBounds(new Rectangle(426, 189, 199, 66)); jScrollPane3.setBounds(new Rectangle(28, 379, 597, 157)); jScrollPane1.getViewport().add(jList1, null); jScrollPane2.getViewport().add(jTextArea1, null); jScrollPane3.getViewport().add(jTable1, null); //設置單選框的屬性 jRadioButton1.setText("已付款"); jRadioButton1.setSelected(true); jRadioButton1.setBounds(new Rectangle(487, 263, 68, 25)); jRadioButton2.setText("未付款"); jRadioButton2.setBounds(new Rectangle(557, 263, 68, 25)); //使單選項在同一個控件組內 buttonGroup1.add(jRadioButton1); buttonGroup1.add(jRadioButton2); contentPane.setAlignmentY((float) 0.5); //為列表框加入選擇接收器 jList1.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //當多種事件被激發的時候,不執行接收器后面的代碼 if (e.getValueIsAdjusting()) return; jList1_valueChanged(e); } }); //設置下拉列表框的屬性 jComboBox1.setBounds(new Rectangle(267, 45, 156, 22)); jComboBox1.addItem("根據單據編號查詢"); jComboBox1.addItem("根據訂購員查詢"); jComboBox1.addItem("根據現金管理員查詢"); jComboBox1.addItem("根據倉庫名查詢"); jComboBox1.addItem("根據完成狀態查詢"); jComboBox1.addItem("根據訂單日期查詢"); //為面板加入各個控件 contentPane.add(jLabel1, null); contentPane.add(jLabel2, null); contentPane.add(jLabel3, null); contentPane.add(jLabel4, null); contentPane.add(jLabel5, null); contentPane.add(jLabel6, null); contentPane.add(jLabel7, null); contentPane.add(jLabel8, null); contentPane.add(jLabel9, null); contentPane.add(jLabel10, null); contentPane.add(jLabel11, null); contentPane.add(jLabel12, null); contentPane.add(jLabel13, null); contentPane.add(jLabel14, null); contentPane.add(jLabel15, null); contentPane.add(jLabel16, null); contentPane.add(jLabel17, null); contentPane.add(jLabel18, null); contentPane.add(jLabel19, null); contentPane.add(jLabel20, null); contentPane.add(jComboBox1, null); contentPane.add(jTextField1, null); contentPane.add(jTextField2, null); contentPane.add(jTextField3, null); contentPane.add(jTextField4, null); contentPane.add(jTextField5, null); contentPane.add(jTextField6, null); contentPane.add(jTextField7, null); contentPane.add(jTextField8, null); contentPane.add(jTextField9, null); contentPane.add(jTextField10, null); contentPane.add(jTextField11, null); contentPane.add(jTextField12, null); contentPane.add(jTextField13, null); contentPane.add(jTextField14, null); contentPane.add(jTextField15, null); contentPane.add(jScrollPane1, null); contentPane.add(jScrollPane2, null); contentPane.add(jScrollPane3, null); contentPane.add(jRadioButton1, null); contentPane.add(jRadioButton2, null); contentPane.add(jButton1, null); contentPane.add(jButton2, null); contentPane.add(jButton3, null); contentPane.add(jButton4, null); contentPane.add(jButton5, null); contentPane.add(jButton6, null); //設置窗口類的字體和為按鈕加入動作接收器 setupFontAndListener(); } //設置窗口類的字體和為按鈕加入動作接收器的方法 public void setupFontAndListener(){ Component[] components = contentPane.getComponents(); //創建臨時按鈕控件 JButton tmpBtn = new JButton(); for(int i = 0; i < components.length; i++){ components[i].setFont(dialog13); if(components[i].getClass().getName().equals("javax.swing.JButton")){ tmpBtn = (JButton)components[i]; tmpBtn.addActionListener(this); } } } //退出方法 public void exit(){ //隱藏窗口 this.setVisible(false); //清空數組的內容 stockLedgers = new String[0][13]; stockSubLedgers = new String[0][6]; stockSubLedgerObjects = new Object[0][7]; //清空列表框的內容 listData1.clear(); //清空文本框的內容 jTextArea1.setText(""); //清空表格的內容 stockSubLedgerObjects = new Object[0][7]; this.showTableData(stockSubLedgerObjects); //取得面板上的所有控件 Component[] components = contentPane.getComponents(); //創建臨時編輯框控件 JTextField tmpTextField = new JTextField(); for(int i = 0; i < components.length; i++){ if(components[i].getClass().getName().equals("javax.swing.JTextField")){ tmpTextField = (JTextField)components[i]; //清空編輯框的內容 tmpTextField.setText(""); } } } //設置用戶的方法 public void setUser(User user) { this.user = user; } //設置賬套的方法 public void setLedgerDate(String ledgerDate) {
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -