📄 returnorderpayframe.java
字号:
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;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 = ""; //声明退货单打印窗口 ReturnOrderPrintFrame returnOrderPrintFrame = 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(""); //清空表格的内容 this.showTableData(stockSubLedgerObjects); //取得面板上的所有控件 Component[] components = contentPane.getComponents(); //创建临时编辑框控件 JTextField tmpTextField = new JTextField(); for(int i = 0; i < components.length; i++){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -