Java stand alone bookstore management system (practice design module and idea)_ Series 3

Familiar with memory 2021-01-21 14:39:58
java stand bookstore management practice


Java- Stand alone version of the bookstore management system ( Practice designing modules and ideas _ series Two ): http://blog.csdn.net/qq_26525215/article/details/51089734

Java- Stand alone version of the bookstore management system ( Practice designing modules and ideas _ series One ): http://blog.csdn.net/qq_26525215/article/details/51073546

Introduce

Today's one of the series two add user input bug Resolved , Added user module , Delete user , And modify the user module .

The following code is a modified or added class relative to series 2 .

First look at AddPanel Class modification : You can prevent that by taking precautions when you collect parameters bug 了 .

cn.hncu.bookStore.user.ui;

AddPanel class :( Add user module )

/*
* AddPanel.java
*
* Created on __DATE__, __TIME__
*/
package cn.hncu.bookStore.user.ui;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import cn.hncu.bookStore.common.UserTypeEnum;
import cn.hncu.bookStore.user.business.ebi.UserEbi;
import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.vo.UserModel;
import cn.hncu.bookStore.util.FileIoUtil;
/**
*
* @author Chen Haoxiang
*/
public class AddPanel extends javax.swing.JPanel {
private JFrame mainFrame = null;
/** Creates new form AddPanel */
public AddPanel(JFrame mainFrame) {
this.mainFrame = mainFrame;
initComponents();
myInitData();
}
private void myInitData() {
for (UserTypeEnum type : UserTypeEnum.values()) {
combType.addItem(type.getName());
}
}
/** 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();
jLabel2 = new javax.swing.JLabel();
tfdName = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
tfdUuid = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
tfdPwd2 = new javax.swing.JPasswordField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
combType = new javax.swing.JComboBox();
tfdPwd = new javax.swing.JPasswordField();
btnAdd = new javax.swing.JButton();
btnBack = new javax.swing.JButton();
setMinimumSize(new java.awt.Dimension(800, 600));
setLayout(null);
jLabel1.setFont(new java.awt.Font(" Microsoft YaHei ", 1, 48));
jLabel1.setForeground(new java.awt.Color(204, 0, 0));
jLabel1.setText("\u6dfb\u52a0\u7528\u6237");
add(jLabel1);
jLabel1.setBounds(330, 30, 230, 80);
jLabel2.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel2.setText("\u7528\u6237\u7c7b\u578b:");
add(jLabel2);
jLabel2.setBounds(90, 310, 90, 30);
tfdName.setFont(new java.awt.Font("Dialog", 1, 18));
tfdName.setAutoscrolls(false);
add(tfdName);
tfdName.setBounds(470, 160, 120, 30);
jLabel3.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel3.setText("uuid:");
add(jLabel3);
jLabel3.setBounds(120, 160, 50, 30);
tfdUuid.setFont(new java.awt.Font("Dialog", 1, 12));
add(tfdUuid);
tfdUuid.setBounds(190, 160, 110, 30);
jLabel4.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel4.setText("\u59d3\u540d:");
add(jLabel4);
jLabel4.setBounds(410, 160, 50, 30);
tfdPwd2.setFont(new java.awt.Font(" Song style ", 1, 18));
add(tfdPwd2);
tfdPwd2.setBounds(470, 240, 170, 30);
jLabel5.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel5.setText("\u5bc6\u7801:");
add(jLabel5);
jLabel5.setBounds(120, 240, 50, 30);
jLabel6.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel6.setText("\u786e\u8ba4\u5bc6\u7801:");
add(jLabel6);
jLabel6.setBounds(380, 240, 90, 30);
combType.setFont(new java.awt.Font("Dialog", 1, 18));
combType.setForeground(new java.awt.Color(51, 51, 255));
combType.setModel(new javax.swing.DefaultComboBoxModel(
new String[] { " Please select ..." }));
add(combType);
combType.setBounds(190, 310, 160, 30);
tfdPwd.setFont(new java.awt.Font(" Song style ", 1, 18));
add(tfdPwd);
tfdPwd.setBounds(190, 240, 160, 30);
btnAdd.setFont(new java.awt.Font("Dialog", 1, 24));
btnAdd.setForeground(new java.awt.Color(0, 204, 204));
btnAdd.setText("\u6dfb\u52a0");
btnAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAddActionPerformed(evt);
}
});
add(btnAdd);
btnAdd.setBounds(190, 430, 120, 60);
btnBack.setFont(new java.awt.Font("Dialog", 1, 24));
btnBack.setForeground(new java.awt.Color(0, 204, 204));
btnBack.setText("\u8fd4\u56de");
btnBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBackActionPerformed(evt);
}
});
add(btnBack);
btnBack.setBounds(520, 430, 120, 60);
}// </editor-fold>
//GEN-END:initComponents
private void back() {
mainFrame.setContentPane(new ListPanel(mainFrame));
mainFrame.validate();
}
/**
* Monitor return button
* @param Back button click monitoring
*/
private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {
back();
}
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {
//1 Collection parameters
String uuid = tfdUuid.getText();
String name = tfdName.getText();
String pwd = new String(tfdPwd.getPassword());
String pwd2 = new String(tfdPwd2.getPassword());
//System.out.println(uuid);
//System.out.println(uuid+","+name+","+pwd);
if (uuid.equals("") || uuid.equals(null)) {
JOptionPane.showMessageDialog(mainFrame, " user ID It's empty , Please re-enter !");
return;
}
if (name.equals("") || name.equals(null)) {
JOptionPane.showMessageDialog(mainFrame, " User name is empty , Please re-enter !");
return;
}
if (!pwd.equals(pwd2) || pwd.equals("") || pwd.equals(null)
|| pwd2.equals("") || pwd2.equals(null)) {
JOptionPane.showMessageDialog(mainFrame, " The two password inputs are inconsistent or the password is empty , Please re-enter !");
return;
}
int type = 0;
try {
type = UserTypeEnum.getTypeByName(combType.getSelectedItem()
.toString());
} catch (Exception e) {
JOptionPane.showMessageDialog(mainFrame, " Please specify the user type !");
return;
}
//2 Organizational parameters
UserModel user = new UserModel();
user.setName(name);
user.setPwd(pwd);
user.setType(type);
user.setUuid(uuid);
//3 Call logic layer
UserEbi ebi = UserEbiFactory.getUserEbi();
//4 According to the results returned by the call, different pages are directed
if (ebi.create(user)) {
back();
} else {
JOptionPane.showMessageDialog(null, " The user already exists !");
}
}
//GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JButton btnAdd;
private javax.swing.JButton btnBack;
private javax.swing.JComboBox combType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JTextField tfdName;
private javax.swing.JPasswordField tfdPwd;
private javax.swing.JPasswordField tfdPwd2;
private javax.swing.JTextField tfdUuid;
// End of variables declaration//GEN-END:variables
}

| | |

cn.hncu.bookStore.user.ui;

DeletePanel class :( Delete user module )

/*
* DeletePanel.java
*
* Created on __DATE__, __TIME__
*/
package cn.hncu.bookStore.user.ui;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import cn.hncu.bookStore.common.UserTypeEnum;
import cn.hncu.bookStore.user.business.ebi.UserEbi;
import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.vo.UserModel;
import cn.hncu.bookStore.util.FileIoUtil;
/**
*
* @author Chen Haoxiang
*
* @version 1.0
*/
public class DeletePanel extends javax.swing.JPanel {
private JFrame mainFrame = null;
private String uuid = null;
/** Creates new form DeletePanel
* @param uuid */
public DeletePanel(JFrame mainFrame, String uuid) {
this.mainFrame = mainFrame;
this.uuid = uuid;
initComponents();
myInitData();
}
private void myInitData() {
UserEbi user = UserEbiFactory.getUserEbi();
UserModel userModel = user.getSingle(uuid);
tfdName.setText(userModel.getName());
tfdUuid.setText(userModel.getUuid());
tfdPwd.setText(userModel.getPwd());
tfdType.setText(UserTypeEnum.getNameByType(userModel.getType()));
tfdName.setEditable(false);
tfdPwd.setEditable(false);
tfdType.setEditable(false);
tfdUuid.setEditable(false);
}
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
tfdName = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
tfdUuid = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
tfdPwd = new javax.swing.JTextField();
tfdType = new javax.swing.JTextField();
btnBack = new javax.swing.JButton();
btnDelete = new javax.swing.JButton();
setMinimumSize(new java.awt.Dimension(800, 600));
setLayout(null);
jLabel1.setFont(new java.awt.Font(" Microsoft YaHei ", 1, 48));
jLabel1.setForeground(new java.awt.Color(204, 0, 0));
jLabel1.setText("\u5220\u9664\u7528\u6237");
add(jLabel1);
jLabel1.setBounds(330, 30, 230, 80);
jLabel2.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel2.setText("\u7528\u6237\u7c7b\u578b:");
add(jLabel2);
jLabel2.setBounds(100, 310, 90, 30);
tfdName.setFont(new java.awt.Font("Dialog", 1, 18));
tfdName.setAutoscrolls(false);
add(tfdName);
tfdName.setBounds(480, 160, 120, 30);
jLabel3.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel3.setText("uuid:");
add(jLabel3);
jLabel3.setBounds(130, 160, 50, 30);
tfdUuid.setFont(new java.awt.Font("Dialog", 0, 11));
add(tfdUuid);
tfdUuid.setBounds(200, 160, 110, 30);
jLabel4.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel4.setText("\u59d3\u540d:");
add(jLabel4);
jLabel4.setBounds(420, 160, 50, 30);
jLabel5.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel5.setText("\u5bc6\u7801:");
add(jLabel5);
jLabel5.setBounds(130, 240, 50, 30);
tfdPwd.setFont(new java.awt.Font("Tahoma", 1, 12));
add(tfdPwd);
tfdPwd.setBounds(200, 240, 160, 30);
tfdType.setFont(new java.awt.Font("Dialog", 1, 12));
add(tfdType);
tfdType.setBounds(200, 310, 160, 30);
btnBack.setFont(new java.awt.Font("Dialog", 1, 24));
btnBack.setForeground(new java.awt.Color(0, 204, 204));
btnBack.setText("\u8fd4\u56de");
btnBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBackActionPerformed(evt);
}
});
add(btnBack);
btnBack.setBounds(540, 450, 120, 60);
btnDelete.setFont(new java.awt.Font("Dialog", 1, 24));
btnDelete.setForeground(new java.awt.Color(0, 204, 204));
btnDelete.setText("\u5220\u9664");
btnDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDeleteActionPerformed(evt);
}
});
add(btnDelete);
btnDelete.setBounds(210, 450, 120, 60);
}// </editor-fold>
//GEN-END:initComponents
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {
//3 Call logic layer
if (UserEbiFactory.getUserEbi().delete(uuid)) {
back();
} else {
JOptionPane.showMessageDialog(mainFrame, " The user no longer exists !");
}
//4 According to the results returned by the call, different pages are directed
}
private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {
back();
}
private void back() {
mainFrame.setContentPane(new ListPanel(mainFrame));
mainFrame.validate();
}
//GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JButton btnBack;
private javax.swing.JButton btnDelete;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField tfdName;
private javax.swing.JTextField tfdPwd;
private javax.swing.JTextField tfdType;
private javax.swing.JTextField tfdUuid;
// End of variables declaration//GEN-END:variables
}

| | |

cn.hncu.bookStore.user.ui;

UpdatePanel class :( Modify user module )

/*
* UpdatePanel.java
*
* Created on __DATE__, __TIME__
*/
package cn.hncu.bookStore.user.ui;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import cn.hncu.bookStore.common.UserTypeEnum;
import cn.hncu.bookStore.user.business.ebi.UserEbi;
import cn.hncu.bookStore.user.business.factory.UserEbiFactory;
import cn.hncu.bookStore.user.vo.UserModel;
/**
*
* @author Chen Haoxiang
*
* @version 1.0
*/
public class UpdatePanel extends javax.swing.JPanel {
private JFrame mainFrame = null;
private String uuid = null;
/**
* Creates new form UpdatePanel
*
* @param uuid
* @param mainFrame
*/
public UpdatePanel(JFrame mainFrame, String uuid) {
this.mainFrame = mainFrame;
this.uuid = uuid;
initComponents();
myInitData();
}
private void myInitData() {
UserEbi ebi = UserEbiFactory.getUserEbi();
UserModel user = ebi.getSingle(uuid);
tfdUuid.setText(user.getUuid());
tfdUuid.setEditable(false);
tfdName.setText(user.getName());
tfdPwd.setText(user.getPwd());
tfdPwd2.setText(user.getPwd());
combType.removeAllItems();
String usert = UserTypeEnum.getNameByType(user.getType());
combType.addItem(usert);
for (UserTypeEnum userType : UserTypeEnum.values()) {
if (!userType.getName().equals(usert)) {
combType.addItem(userType.getName());
}
}
}
// GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
tfdName = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
tfdUuid = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
tfdPwd2 = new javax.swing.JPasswordField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
tfdPwd = new javax.swing.JPasswordField();
combType = new javax.swing.JComboBox();
btnBack = new javax.swing.JButton();
btnUpdate = new javax.swing.JButton();
setMinimumSize(new java.awt.Dimension(800, 600));
setLayout(null);
jLabel1.setFont(new java.awt.Font(" Microsoft YaHei ", 1, 48));
jLabel1.setForeground(new java.awt.Color(204, 0, 0));
jLabel1.setText("\u4fee\u6539\u7528\u6237");
add(jLabel1);
jLabel1.setBounds(320, 30, 230, 80);
jLabel2.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel2.setText("\u7528\u6237\u7c7b\u578b:");
add(jLabel2);
jLabel2.setBounds(90, 310, 90, 30);
tfdName.setFont(new java.awt.Font("Dialog", 1, 18));
tfdName.setAutoscrolls(false);
add(tfdName);
tfdName.setBounds(470, 160, 120, 30);
jLabel3.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel3.setText("uuid:");
add(jLabel3);
jLabel3.setBounds(120, 160, 50, 30);
tfdUuid.setFont(new java.awt.Font("Dialog", 1, 12));
add(tfdUuid);
tfdUuid.setBounds(190, 160, 110, 30);
jLabel4.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel4.setText("\u59d3\u540d:");
add(jLabel4);
jLabel4.setBounds(410, 160, 50, 30);
tfdPwd2.setFont(new java.awt.Font("Dialog", 1, 18));
add(tfdPwd2);
tfdPwd2.setBounds(470, 240, 170, 30);
jLabel5.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel5.setText("\u5bc6\u7801:");
add(jLabel5);
jLabel5.setBounds(120, 240, 50, 30);
jLabel6.setFont(new java.awt.Font(" Microsoft YaHei ", 0, 18));
jLabel6.setText("\u786e\u8ba4\u5bc6\u7801:");
add(jLabel6);
jLabel6.setBounds(380, 240, 90, 30);
tfdPwd.setFont(new java.awt.Font(" Song style ", 1, 18));
add(tfdPwd);
tfdPwd.setBounds(190, 240, 160, 30);
combType.setFont(new java.awt.Font("Dialog", 1, 12));
combType.setForeground(new java.awt.Color(51, 0, 255));
combType.setModel(new javax.swing.DefaultComboBoxModel(
new String[] { "" }));
add(combType);
combType.setBounds(190, 310, 170, 30);
btnBack.setFont(new java.awt.Font("Dialog", 1, 24));
btnBack.setForeground(new java.awt.Color(0, 204, 204));
btnBack.setText("\u8fd4\u56de");
btnBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBackActionPerformed(evt);
}
});
add(btnBack);
btnBack.setBounds(500, 430, 120, 60);
btnUpdate.setFont(new java.awt.Font("Dialog", 1, 24));
btnUpdate.setForeground(new java.awt.Color(0, 204, 204));
btnUpdate.setText("\u4fee\u6539");
btnUpdate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnUpdateActionPerformed(evt);
}
});
add(btnUpdate);
btnUpdate.setBounds(170, 430, 120, 60);
}// </editor-fold>
// GEN-END:initComponents
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {
// 1 Collection parameters
String uuid = tfdUuid.getText();
String name = tfdName.getText();
String pwd = new String(tfdPwd.getPassword());
String pwd2 = new String(tfdPwd2.getPassword());
if (uuid.equals("") || uuid.equals(null)) {
JOptionPane.showMessageDialog(mainFrame, " user ID It's empty , Please re-enter !");
return;
}
if (name.equals("") || name.equals(null)) {
JOptionPane.showMessageDialog(mainFrame, " User name is empty , Please re-enter !");
return;
}
if (!pwd.equals(pwd2) || pwd.equals("") || pwd.equals(null)
|| pwd2.equals("") || pwd2.equals(null)) {
JOptionPane.showMessageDialog(mainFrame, " The two password inputs are inconsistent or the password is empty , Please re-enter !");
return;
}
int type = 0;
try {
type = UserTypeEnum.getTypeByName(combType.getSelectedItem()
.toString());
} catch (Exception e) {
JOptionPane.showMessageDialog(mainFrame, " Please specify the user type !");
return;
}
// 2 Organizational parameters
UserModel user = new UserModel();
user.setName(name);
user.setPwd(pwd);
user.setType(type);
user.setUuid(uuid);
// 3 Call logic layer
UserEbi ebi = UserEbiFactory.getUserEbi();
// 4 According to the results returned by the call, different pages are directed
if (ebi.update(user)) {
back();
} else {
JOptionPane.showMessageDialog(null, " The user no longer exists !");
}
}
private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {
back();
}
private void back() {
mainFrame.setContentPane(new ListPanel(mainFrame));
mainFrame.validate();
}
// GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JButton btnBack;
private javax.swing.JButton btnUpdate;
private javax.swing.JComboBox combType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JTextField tfdName;
private javax.swing.JPasswordField tfdPwd;
private javax.swing.JPasswordField tfdPwd2;
private javax.swing.JTextField tfdUuid;
// End of variables declaration//GEN-END:variables
}

| | |

cn.hncu.bookStore.user.ui;

ListPanel class ( Call user function module )

/*
* ListPanel.java
*
* Created on __DATE__, __TIME__
*/
package cn.hncu.bookStore.user.ui;
import java.util.List;
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.vo.UserModel;
/**
* The presentation layer - User list panel
*
* @author Chen Haoxiang
* @version 1.0
*/
public class ListPanel extends javax.swing.JPanel {
private JFrame mainFrame = null;
/** Creates new form ListPanel */
public ListPanel(JFrame mainFrame) {
this.mainFrame = mainFrame;
initComponents();
myInitData();
}
/**
* Read all users and add them to the list
*/
private void myInitData() {
UserEbi user = UserEbiFactory.getUserEbi();
List<UserModel> list = user.getAll();
userLists.setListData(list.toArray());
}
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
userLists = new javax.swing.JList();
jLabel1 = new javax.swing.JLabel();
btnToAdd = new javax.swing.JButton();
btnToDelete = new javax.swing.JButton();
btnToUpdate = new javax.swing.JButton();
setMinimumSize(new java.awt.Dimension(800, 600));
setLayout(null);
userLists.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "" };
public int getSize() {
return strings.length;
}
public Object getElementAt(int i) {
return strings[i];
}
});
jScrollPane1.setViewportView(userLists);
add(jScrollPane1);
jScrollPane1.setBounds(170, 80, 480, 230);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 48));
jLabel1.setForeground(new java.awt.Color(204, 0, 51));
jLabel1.setText("User List");
add(jLabel1);
jLabel1.setBounds(300, 0, 260, 80);
btnToAdd.setFont(new java.awt.Font("Dialog", 1, 24));
btnToAdd.setForeground(new java.awt.Color(0, 102, 102));
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(160, 350, 150, 50);
btnToDelete.setFont(new java.awt.Font("Dialog", 1, 24));
btnToDelete.setForeground(new java.awt.Color(0, 102, 102));
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(510, 350, 150, 50);
btnToUpdate.setFont(new java.awt.Font("Dialog", 1, 24));
btnToUpdate.setForeground(new java.awt.Color(0, 102, 102));
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(160, 450, 150, 50);
}// </editor-fold>
//GEN-END:initComponents
private void btnToUpdateActionPerformed(java.awt.event.ActionEvent evt) {
UserModel user = (UserModel) userLists.getSelectedValue();
if (user == null) {
JOptionPane.showMessageDialog(mainFrame, " Please select the user to modify !");
return;
}
String uuid = user.getUuid();
mainFrame.setContentPane(new UpdatePanel(mainFrame, uuid));
mainFrame.validate();
}
private void btnToDeleteActionPerformed(java.awt.event.ActionEvent evt) {
UserModel user = (UserModel) userLists.getSelectedValue();
if (user == null) {
JOptionPane.showMessageDialog(mainFrame, " Please select the user to delete !");
return;
}
String uuid = user.getUuid();
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 btnToUpdate;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JList userLists;
// End of variables declaration//GEN-END:variables
}

Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .

版权声明
本文为[Familiar with memory]所创,转载请带上原文链接,感谢
https://javamana.com/2021/01/20210121143722292T.html

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云