⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vipmodifyaction.java

📁 好的超市源码供大家下载
💻 JAVA
字号:
package action.implementclass.dialogaction;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Iterator;
import java.util.Vector;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

import dao.VipDao;

import view.dialog.VipModifyDialog;
import view.dialog.basedialog.VipBaseDialog;
import view.dialog.dialogoper.VipBaseOper;
import vo.VipVo;
/**
 * 修改会员信息事件
 * @author wenjie
 *
 */
public class VipModifyAction implements ActionListener{

  public void actionPerformed(ActionEvent e) {
    int row = VipBaseDialog.table.getSelectedRow();
    if (e.getActionCommand().equals("确定")) {
      int ch = JOptionPane.showConfirmDialog(null, "确定要修改吗?", "提示信息",
          JOptionPane.YES_NO_OPTION);
      // 确认是否修改该记录

      if (ch == JOptionPane.YES_OPTION) {
        if (new VipDao().updateVip(VipBaseOper.getInputTextValue())) {

          JOptionPane.showMessageDialog(null, "修改成功,请按刷新按钮进行查看");

        } else {
          JOptionPane.showMessageDialog(null, "修改不成功!");
        }
      }
      
      
    } else if (e.getActionCommand().equals("取消")) {
      VipModifyDialog.vipModifyDialog.dispose();
    
    } else if(e.getActionCommand().equals("数据上移")){
      VipBaseOper.initialModifyValue();
    }
    else if (e.getActionCommand().equals("重置")) {
        VipBaseOper.initialTextValue();

    } else if (e.getActionCommand().equals("刷新")) {
      Vector v = new VipDao().getVipInfo();
      Iterator iter = v.iterator();
      DefaultTableModel tableModel = (DefaultTableModel) VipBaseDialog.table
          .getModel();
      int counts = tableModel.getRowCount();

      // 循环删除jtable中的所有数据
      for (int i = counts - 1; i >= 0; i--) {
        tableModel.removeRow(i);
      }
      while (iter.hasNext()) {
        VipVo value = (VipVo) iter.next();
        Object[] data = { new Integer(value.getVip_id()), value.getVip_name(),
            value.getVip_type(), new Double(value.getPrice_pct()),
            new Long(value.getPhone()), };
        tableModel.addRow(data);
      }
    }
    
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -