欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

java書店系統(tǒng)畢業(yè)設(shè)計 用戶模塊(3)

 更新時間:2016年10月11日 15:32:04   作者:xanlv  
這篇文章主要介紹了java書店系統(tǒng)畢業(yè)設(shè)計,第三步系統(tǒng)總體設(shè)計,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了java書店系統(tǒng)畢業(yè)設(shè)計第3篇,供大家參考,具體內(nèi)容如下

import java.util.List;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.vo.UserModel;

/**
 *
 * @author __USER__
 */
public class listPanel extends javax.swing.JPanel {

 private static final long serialVersionUID = 1L;
 private JFrame mainFrame = null;

 public listPanel(JFrame mainFrame) {//初始化
 this.mainFrame = mainFrame;
 initComponents();
 myInitDate();
 }

 @SuppressWarnings("unchecked")
 public listPanel(JFrame mainFrame, List<UserModel> list) {
 this.mainFrame = mainFrame;
 initComponents();
 jList.setListData(list.toArray());
 }

 @SuppressWarnings("unchecked")
 private void myInitDate() {
 List<UserModel> list = UserEbiFactory.getUserEbi().getAll();
 jList.setListData(list.toArray());

 }
 //***這一段是自動生成的,下面將不再寫***
 /** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
 //GEN-BEGIN:initComponents
 // <editor-fold defaultstate="collapsed" desc="Generated Code">
 private void initComponents() {

 jLabel1 = new javax.swing.JLabel();
 jScrollPane1 = new javax.swing.JScrollPane();
 jList = new javax.swing.JList();
 btnToDelete = new javax.swing.JButton();
 btnToUpDate = new javax.swing.JButton();
 btnToQuery = new javax.swing.JButton();
 btnToAdd = new javax.swing.JButton();

 setBackground(new java.awt.Color(0, 153, 51));
 setMinimumSize(new java.awt.Dimension(800, 600));
 setLayout(null);

 jLabel1.setFont(new java.awt.Font("Microsoft YaHei UI", 1, 36));
 jLabel1.setForeground(new java.awt.Color(204, 0, 204));
 jLabel1.setText("\u7528\u6237\u7ba1\u7406");
 add(jLabel1);
 jLabel1.setBounds(330, 100, 190, 60);

 jScrollPane1.setForeground(new java.awt.Color(0, 51, 153));
 jScrollPane1.setFont(new java.awt.Font("Microsoft YaHei UI", 1, 18));

 jList.setFont(new java.awt.Font("Microsoft YaHei UI", 1, 24));
 jList.setModel(new javax.swing.AbstractListModel() {
  String[] strings = { "" };

  public int getSize() {
  return strings.length;
  }

  public Object getElementAt(int i) {
  return strings[i];
  }
 });
 jScrollPane1.setViewportView(jList);

 add(jScrollPane1);
 jScrollPane1.setBounds(190, 170, 410, 220);

 btnToDelete.setFont(new java.awt.Font("Microsoft YaHei UI", 1, 18));
 btnToDelete.setText("\u5220\u9664\u7528\u6237");
 btnToDelete.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
  btnToDeleteActionPerformed(evt);
  }
 });
 add(btnToDelete);
 btnToDelete.setBounds(240, 470, 110, 40);

 btnToUpDate.setFont(new java.awt.Font("Microsoft YaHei UI", 1, 18));
 btnToUpDate.setText("\u4fee\u6539\u7528\u6237");
 btnToUpDate.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
  btnToUpDateActionPerformed(evt);
  }
 });
 add(btnToUpDate);
 btnToUpDate.setBounds(430, 470, 110, 40);

 btnToQuery.setFont(new java.awt.Font("Microsoft YaHei UI", 1, 18));
 btnToQuery.setText("\u67e5\u627e\u7528\u6237");
 btnToQuery.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
  btnToQueryActionPerformed(evt);
  }
 });
 add(btnToQuery);
 btnToQuery.setBounds(600, 470, 110, 40);

 btnToAdd.setFont(new java.awt.Font("Microsoft YaHei UI", 1, 18));
 btnToAdd.setText("\u6dfb\u52a0\u7528\u6237");
 btnToAdd.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
  btnToAddActionPerformed(evt);
  }
 });
 add(btnToAdd);
 btnToAdd.setBounds(60, 470, 110, 40);
 }// </editor-fold>
 //GEN-END:initComponents

 private void btnToQueryActionPerformed(java.awt.event.ActionEvent evt) {
 mainFrame.setContentPane(new QueryPanel(mainFrame));
 mainFrame.validate();
 }

 private void btnToUpDateActionPerformed(java.awt.event.ActionEvent evt) {
 if (jList.getSelectedValue() == null) {
  JOptionPane.showMessageDialog(this, "請選擇要修改的用戶");
  return;
 }
 String uuid = jList.getSelectedValue().toString().split(",")[0];
 mainFrame.setContentPane(new UpdatePanel(mainFrame, uuid));
 mainFrame.validate();
 }

 private void btnToDeleteActionPerformed(java.awt.event.ActionEvent evt) {
 if (jList.getSelectedValue() == null) {
  JOptionPane.showMessageDialog(this, "請選擇要刪除的用戶");
  return;
 }
 String uuid = jList.getSelectedValue().toString().split(",")[0];
 mainFrame.setContentPane(new DeletePanel(mainFrame, uuid));
 mainFrame.validate();
 }

 private void btnToAddActionPerformed(java.awt.event.ActionEvent evt) {
 mainFrame.setContentPane(new AddPanel(mainFrame));
 mainFrame.validate();
 }
 //***這一段是自動生成的,下面將不再寫***
 //GEN-BEGIN:variables
 // Variables declaration - do not modify
 private javax.swing.JButton btnToAdd;
 private javax.swing.JButton btnToDelete;
 private javax.swing.JButton btnToQuery;
 private javax.swing.JButton btnToUpDate;
 private javax.swing.JLabel jLabel1;
 private javax.swing.JList jList;
 private javax.swing.JScrollPane jScrollPane1;
 // End of variables declaration//GEN-END:variables
}

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.common.UserTypeEnum;
import cn.hncu.bookStore.user.vo.UserModel;

/**
 *
 * @author __USER__
 */
public class AddPanel extends javax.swing.JPanel {

 private static final long serialVersionUID = 1L;
 private JFrame mainFrame = null;

 /** Creates new form AddPanel */
 public AddPanel(JFrame mainFrame) {
 this.mainFrame = mainFrame;
 initComponents();
 myinitDate();
 }

 @SuppressWarnings("unchecked")
 private void myinitDate() {
 combType.removeAllItems();
 for (UserTypeEnum utm:UserTypeEnum.values()) {
  combType.addItem(utm.getName());
 }
 }
 //***自動生成代碼略過***
 // </editor-fold>
 //GEN-END:initComponents

 private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {
 mainFrame.setContentPane(new listPanel(mainFrame));
 mainFrame.validate();
 }

 private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {
 String strName = tfdName.getText().trim();
 String strUuid = tfdUuid.getText().trim();
 String strPwd = new String(tfdPwd.getPassword());
 String strPwd2 =new String(tfdPwd2.getPassword());
 if (!strPwd.equals(strPwd2)) {
  JOptionPane.showMessageDialog(this, "密碼錯誤!");
  return;
 }
 String strCombType = combType.getSelectedItem().toString();

 UserModel um = new UserModel();
 um.setName(strName);
 um.setUuid(strUuid);
 um.setPwd(strPwd);
 um.setType(UserTypeEnum.getTypeByName(strCombType));

 boolean boo = UserEbiFactory.getUserEbi().create(um);

 if (boo) {
  btnCancelActionPerformed(null);
 } else {
  JOptionPane.showMessageDialog(this, "用戶已存在!");
  return;
 }

 }
 //***自動生成代碼略過***
 //GEN-BEGIN
}

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import cn.hncu.bookStore.user.business.ebi.UserEbi;
import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.common.UserTypeEnum;
import cn.hncu.bookStore.user.vo.UserModel;

/**
 *
 * @author __USER__
 */
public class DeletePanel extends javax.swing.JPanel {

 private static final long serialVersionUID = 1L;
 private JFrame mainFrame = null;
 private String uuid;
 UserEbi ebi = UserEbiFactory.getUserEbi();

 /** Creates new form AddPanel */
 public DeletePanel(JFrame mainFrame, String uuid) {
 this.mainFrame = mainFrame;
 this.uuid = uuid;
 initComponents();
 myinitDate();
 }

 @SuppressWarnings("unchecked")
 private void myinitDate() {
 UserModel um = ebi.getSingle(uuid);
 tfdUuid.setText(uuid);
 tfdUuid.setEnabled(false);
 tfdName.setText(um.getName());
 tfdName.setEnabled(false);
 tfdPwd.setText(um.getPwd());
 tfdPwd.setEnabled(false);
 tfdPwd2.setText(um.getPwd());
 tfdPwd2.setEnabled(false);
 combType.removeAllItems();
 for (UserTypeEnum utm : UserTypeEnum.values()) {
  combType.addItem(utm.getName());
 }
 combType.setSelectedIndex(um.getType());
 combType.setEnabled(false);

 }
 //***自動生成代碼略過***
 // </editor-fold>
 //GEN-END:initComponents

 private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {
 mainFrame.setContentPane(new listPanel(mainFrame));
 mainFrame.validate();
 }

 private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {
 boolean boo = ebi.delete(uuid);

 if (boo) {
  btnCancelActionPerformed(null);
 } else {
  JOptionPane.showMessageDialog(this, "刪除用戶失敗,用戶已不存在!");
  return;
 }
 }
 //***自動生成代碼略過***
 //GEN-BEGIN
}

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import cn.hncu.bookStore.user.business.ebi.UserEbi;
import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.common.UserTypeEnum;
import cn.hncu.bookStore.user.vo.UserModel;

/**
 *
 * @author __USER__
 */
public class UpdatePanel extends javax.swing.JPanel {

 private static final long serialVersionUID = 1L;
 private JFrame mainFrame = null;
 private String uuid;
 UserEbi ebi = UserEbiFactory.getUserEbi();

 /** Creates new form AddPanel */
 public UpdatePanel(JFrame mainFrame, String uuid) {
 this.mainFrame = mainFrame;
 this.uuid = uuid;
 initComponents();
 myinitDate();
 }

 @SuppressWarnings("unchecked")
 private void myinitDate() {
 UserModel um = ebi.getSingle(uuid);
 tfdUuid.setText(uuid);
 tfdUuid.setEnabled(false);
 tfdName.setText(um.getName());
 tfdPwd.setText(um.getPwd());
 tfdPwd2.setText(um.getPwd());
 combType.removeAllItems();
 for (UserTypeEnum utm : UserTypeEnum.values()) {
  combType.addItem(utm.getName());
 }
 combType.setSelectedIndex(um.getType());

 }
 //***自動生成代碼略過***
 // </editor-fold>
 //GEN-END:initComponents

 private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {
 mainFrame.setContentPane(new listPanel(mainFrame));
 mainFrame.validate();
 }

 private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {
 String strName = tfdName.getText().trim();
 String strUuid = tfdUuid.getText().trim();
 String strPwd = new String(tfdPwd.getPassword());
 String strPwd2 =new String(tfdPwd2.getPassword());
 if (!strPwd.equals(strPwd2)) {
  JOptionPane.showMessageDialog(this, "密碼錯誤!");
  return;
 }
 String strCombType = combType.getSelectedItem().toString();

 UserModel um = new UserModel();
 um.setName(strName);
 um.setUuid(strUuid);
 um.setPwd(strPwd);
 um.setType(UserTypeEnum.getTypeByName(strCombType));

 boolean boo = UserEbiFactory.getUserEbi().update(um);

 if (boo) {
  btnCancelActionPerformed(null);
 } else {
  JOptionPane.showMessageDialog(this, "用戶已存在!");
  return;
 }

 }
 //***自動生成代碼略過***
 //GEN-BEGIN
}

import java.util.List;

import javax.swing.JFrame;

import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.common.UserTypeEnum;
import cn.hncu.bookStore.user.vo.UserModel;
import cn.hncu.bookStore.user.vo.UserQueryModel;

/**
 *
 * @author __USER__
 */
public class QueryPanel extends javax.swing.JPanel {

 private static final long serialVersionUID = 1L;
 private JFrame mainFrame = null;

 /** Creates new form AddPanel */
 public QueryPanel(JFrame mainFrame) {
 this.mainFrame = mainFrame;
 initComponents();
 myinitDate();
 }

 @SuppressWarnings("unchecked")
 private void myinitDate() {
 combType.removeAllItems();
 combType.addItem("請選擇");
 for (UserTypeEnum utm : UserTypeEnum.values()) {
  combType.addItem(utm.getName());
 }

 }
 //***自動生成代碼略過***
 // </editor-fold>
 //GEN-END:initComponents

 private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {
 mainFrame.setContentPane(new listPanel(mainFrame));
 mainFrame.validate();
 }

 private void btnQueryActionPerformed(java.awt.event.ActionEvent evt) {
 String strName = tfdName.getText().trim();
 String strUuid = tfdUuid.getText().trim();
 String strCombType = combType.getSelectedItem().toString();

 UserQueryModel uqm=new UserQueryModel();
 uqm.setName(strName);
 uqm.setUuid(strUuid);
 int type=0;
 if(combType.getSelectedIndex()>0){
  type=UserTypeEnum.getTypeByName(strCombType);
 }
 uqm.setType(type);

 List<UserModel> list= UserEbiFactory.getUserEbi().getByCondition(uqm);
  mainFrame.setContentPane(new listPanel(mainFrame,list));
  mainFrame.validate();


 }
 //***自動生成代碼略過***
 //GEN-BEGIN
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Hadoop+HBase+ZooKeeper分布式集群環(huán)境搭建步驟

    Hadoop+HBase+ZooKeeper分布式集群環(huán)境搭建步驟

    這篇文章主要介紹了Hadoop+HBase+ZooKeeper分布式集群環(huán)境搭建,集群環(huán)境至少需要3個節(jié)點,1個Master,2個Slave,節(jié)點之間局域網(wǎng)連接,可以相互ping通,本文通過實例給大家介紹的非常詳細,需要的朋友可以參考下
    2022-04-04
  • 基于SpringBoot啟動類靜態(tài)資源路徑問題

    基于SpringBoot啟動類靜態(tài)資源路徑問題

    這篇文章主要介紹了SpringBoot啟動類靜態(tài)資源路徑問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-09-09
  • springBoot配置國產(chǎn)達夢數(shù)據(jù)庫的示例詳解

    springBoot配置國產(chǎn)達夢數(shù)據(jù)庫的示例詳解

    本文向大家介紹springBoot?配置國產(chǎn)達夢數(shù)據(jù)庫的相關(guān)知識,文章結(jié)合示例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-04-04
  • Java遍歷Map的方法匯總

    Java遍歷Map的方法匯總

    大家平時在使用Java開發(fā)時,經(jīng)常會遇到遍歷Map對象的問題,本文就給大家介紹幾種Java遍歷Map對象的方法,并簡單分析一下每種方法的效率,需要的朋友可以參考下
    2023-12-12
  • 基于mybatis一對多查詢內(nèi)層排序的問題

    基于mybatis一對多查詢內(nèi)層排序的問題

    這篇文章主要介紹了基于mybatis一對多查詢內(nèi)層排序的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教。
    2022-01-01
  • Java實現(xiàn)的質(zhì)因數(shù)分解操作示例【基于遞歸算法】

    Java實現(xiàn)的質(zhì)因數(shù)分解操作示例【基于遞歸算法】

    這篇文章主要介紹了Java實現(xiàn)的質(zhì)因數(shù)分解操作,結(jié)合實例形式較為詳細的分析了Java基于遞歸算法實現(xiàn)針對整數(shù)的質(zhì)因數(shù)分解相關(guān)操作技巧,需要的朋友可以參考下
    2018-03-03
  • java模擬實現(xiàn)微信紅包算法

    java模擬實現(xiàn)微信紅包算法

    這篇文章主要為大家詳細介紹了java實現(xiàn)模擬微信紅包算法,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2020-11-11
  • SpringBoot個性化配置的方法步驟

    SpringBoot個性化配置的方法步驟

    這篇文章主要介紹了SpringBoot個性化配置的方法步驟,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-02-02
  • Java如何實現(xiàn)驗證碼驗證功能

    Java如何實現(xiàn)驗證碼驗證功能

    這篇文章主要教大家如何實現(xiàn)Java驗證碼驗證功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-02-02
  • Springboot實現(xiàn)動態(tài)定時任務(wù)管理的示例代碼

    Springboot實現(xiàn)動態(tài)定時任務(wù)管理的示例代碼

    最近在做spring boot項目開發(fā)中,由于使用@EnableScheduling注解和@Scheduled注解來實現(xiàn)的定時任務(wù),只能靜態(tài)的創(chuàng)建定時任務(wù),不能動態(tài)修改、添加、刪除、啟/停任務(wù),下面通過本文給大家介紹Springboot實現(xiàn)動態(tài)定時任務(wù)管理的方法,感興趣的朋友跟隨小編一起看看吧
    2023-07-07

最新評論