📄 systempanel1.java
字号:
jRadioButton2.setText(" 操作人员权限");
jRadioButton2.setBounds(new Rectangle(105, 95, 157, 23));
jRadioButton3.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jRadioButton3.setForeground(new Color(255, 118, 62));
jRadioButton3.setText("系统管理员权限");
jRadioButton3.setBounds(new Rectangle(105, 21, 157, 23));
jLabel14.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jLabel14.setForeground(Color.blue);
jLabel14.setText("现 有 人 员");
jLabel14.setBounds(new Rectangle(109, 11, 97, 31));
jButtonS.setBounds(new Rectangle(102, 359, 127, 32));
jButtonS.setFont(new java.awt.Font("宋体", Font.PLAIN, 16));
jButtonS.setForeground(Color.blue);
jButtonS.setText("刷 新");
jButtonS.addActionListener(new SystemPanel1_jButtonS_actionAdapter(this));
jLabel15.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jLabel15.setForeground(Color.red);
jLabel15.setText("需要更改的操作员");
jLabel15.setBounds(new Rectangle(509, 6, 138, 31));
jTablex.setBounds(new Rectangle(23, 69, 311, 279));
jTablex.addMouseListener(new SystemPanel1_jTablex_mouseAdapter(this));
jTablex.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jTablex.setForeground(Color.blue);
jTablex.getTableHeader().setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jTablex.setGridColor(Color.pink);
jTablex.setRowHeight(25);
jTablex.setSelectionBackground(UIManager.getColor(
"InternalFrame.activeTitleGradient"));
jTablex.setSelectionForeground(Color.red);
jTableHeader2.setForeground(Color.blue);
jTableHeader2.setBorder(BorderFactory.createEtchedBorder());
jTableHeader2.setBounds(new Rectangle(23, 44, 312, 23));
jTableT.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jTableT.setForeground(Color.blue);
jTableT.getTableHeader().setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jTableT.getTableHeader().setForeground(Color.blue);
jTableT.setRowHeight(25);
jPanel2.setBorder(BorderFactory.createEtchedBorder());
jPanel2.setBounds(new Rectangle(415, 42, 343, 307));
jPanel2.setLayout(null);
jButton8.setBounds(new Rectangle(434, 359, 97, 32));
jButton8.setEnabled(false);
jButton8.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jButton8.setForeground(Color.red);
jButton8.setText("确认注销");
jButton8.addActionListener(new SystemPanel1_jButton8_actionAdapter(this));
jLabel16.setFont(new java.awt.Font("宋体", Font.BOLD, 16));
jLabel16.setForeground(Color.blue);
jLabel16.setText("现 有 人 员");
jLabel16.setBounds(new Rectangle(115, 9, 97, 31));
jLabel17.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel17.setForeground(Color.blue);
jLabel17.setText("权 限");
jLabel17.setBounds(new Rectangle(16, 110, 71, 42));
jLabelName.setBackground(Color.pink);
jLabelName.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabelName.setForeground(Color.red);
jLabelName.setBorder(BorderFactory.createLineBorder(Color.black));
jLabelName.setText("");
jLabelName.setBounds(new Rectangle(101, 32, 228, 42));
jLabelQuanxian.setBackground(Color.pink);
jLabelQuanxian.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabelQuanxian.setForeground(Color.red);
jLabelQuanxian.setBorder(BorderFactory.createLineBorder(Color.black));
jLabelQuanxian.setText("");
jLabelQuanxian.setBounds(new Rectangle(101, 110, 230, 42));
jLabel20.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel20.setForeground(Color.blue);
jLabel20.setText("登 录 名");
jLabel20.setBounds(new Rectangle(16, 32, 71, 42));
jTextArea1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jTextArea1.setForeground(Color.magenta);
jTextArea1.setBorder(BorderFactory.createEtchedBorder());
jTextArea1.setEditable(false);
jTextArea1.setSelectedTextColor(Color.pink);
jTextArea1.setText("\n 在左表中点击需要修改的操作员\n\n 然后点击确认的相关按扭,完成操作");
jTextArea1.setBounds(new Rectangle(13, 177, 318, 117));
btnQueren.setBounds(new Rectangle(630, 359, 97, 32));
btnQueren.setEnabled(false);
btnQueren.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
btnQueren.setForeground(Color.red);
btnQueren.setText("确认启用");
btnQueren.addActionListener(new SystemPanel1_btnQueren_actionAdapter(this));
this.add(jPanelSystemTop);
jPanelSystemTop.add(jBtczrysz);
jPanelSystemTop.add(jBtxtcssz);
jPanelSystemTop.add(jBttsflsz);
jPanelSystemTop.add(jBtqkflsz);
jPanelSystemTop.add(jBtdzflsz);
jPanelSystemTop.add(jBtsjsz);
this.add(jPaneRightMidel);
jPaneRightMidel.add(jTpRightBottom);
jTpRightBottom.add(jTpRightBottomjPanel3, "增加操作员 ");
jPanelShuoming.add(jLabel5);
jPanelShuoming.add(jLabel10);
jPanelShuoming.add(jLabel6);
jPanelShuoming.add(jLabel7);
jPanelShuoming.add(jLabel11);
jPanelShuoming.add(jLabel8);
jPanelShuoming.add(jLabel9);
jTpRightBottomjPanel3.add(jtxPassword);
jTpRightBottomjPanel3.add(jLabel3);
jTpRightBottomjPanel3.add(jtxName);
jTpRightBottomjPanel3.add(jLabel2);
jTpRightBottomjPanel3.add(jLabel4);
jTpRightBottomjPanel3.add(jtxQuanxian);
jTpRightBottomjPanel3.add(jButton3);
jTpRightBottomjPanel3.add(jButton2);
jTpRightBottomjPanel3.add(jScrollPane1);
jTpRightBottomjPanel3.add(jButton4);
jScrollPane1.getViewport().add(jTableT);
jTpRightBottomjPanel3.add(jPanelShuoming);
jPanel2.add(jLabel17);
jPanel2.add(jLabel20);
jPanel2.add(jLabelName);
jPanel2.add(jLabelQuanxian);
jPanel2.add(jTextArea1);
jTpRightBottomjPanel2.add(jButton8);
jTpRightBottomjPanel2.add(jButtonS);
jTpRightBottomjPanel2.add(btnQueren);
jTpRightBottomjPanel2.add(jLabel15);
jTpRightBottomjPanel2.add(jTablex);
jTpRightBottomjPanel2.add(jTableHeader2);
jTpRightBottomjPanel2.add(jLabel16);
jTpRightBottomjPanel2.add(jPanel2);
jTpRightBottom.add(jTpRightBottomjPanel1, "操作员权限修改 ");
jPanel1.add(jLabel13);
jPanel1.add(jRadioButton3);
jPanel1.add(jRadioButton1);
jPanel1.add(jRadioButton2);
jTpRightBottomjPanel1.add(jButton1);
jTpRightBottomjPanel1.add(jButton5);
jTpRightBottomjPanel1.add(jButton6);
jTpRightBottomjPanel1.add(jLabel12);
jTpRightBottomjPanel1.add(jtxPasswordX);
jTpRightBottomjPanel1.add(jLabel1);
jTpRightBottomjPanel1.add(jTableHeader1);
jTpRightBottomjPanel1.add(jTable1);
jTpRightBottomjPanel1.add(jLabel14);
jTpRightBottomjPanel1.add(jtxNameX);
jTpRightBottomjPanel1.add(jPanel1);
buttonGroup1.add(jRadioButton3);
buttonGroup1.add(jRadioButton1);
buttonGroup1.add(jRadioButton2);
jTpRightBottom.add(jTpRightBottomjPanel2, "注销操作员 ");
}
public void this_ancestorResized(HierarchyEvent e) {
jPaneRightMidel.setSize( (this.getWidth())-5,(this.getHeight()-30));
}
public void jPaneRightMidel_componentResized(ComponentEvent e) {
jTpRightBottom.setSize(jPaneRightMidel.getWidth()-1,
jPaneRightMidel.getHeight()-1);
}
public void jButton2_actionPerformed(ActionEvent e) {
jtxName.setText("");
jtxPassword.setText("");
jtxQuanxian.setText("");
}
public void jButton3_actionPerformed(ActionEvent e) {
//增加
String name = jtxName.getText().trim();
String password = jtxPassword.getText().trim();
String s_quanxian = jtxQuanxian.getText().trim();
if(name.equals(""))
JOptionPane.showMessageDialog(null,"登录名不能为空,重新输入!!!");
else if(password.equals(""))
JOptionPane.showMessageDialog(null,"密码不能为空,重新输入!!!");
else if(s_quanxian.equals(""))
JOptionPane.showMessageDialog(null,"权限不能为空,重新输入!!!");
else
{
try {
int quanxian = Integer.parseInt(s_quanxian);
Dbcom d_Pass = new Dbcom();
String sql = "select quanxian from quanxian where name='" +
name + "'";
String sql1 = "insert into quanxian values ('" + name + "','" +
password + "'," +quanxian+ ",default)";
d_Pass.search(sql);
try {
if (d_Pass.rs.next()) {
JOptionPane.showMessageDialog(this, "登录名已经存在,重新输入!!!");
d_Pass.myClose(1);
}
else
{
d_Pass.myClose(1);
if(d_Pass.add(sql1)){
JOptionPane.showMessageDialog(this,
"恭喜您,添加成功\n 登录名是:" + name + "\n 密码是: " +
password + "\n请妥善保管");
jtxName.setText("");
jtxPassword.setText("");
jtxQuanxian.setText("");
shuaxin(jTableT);
}
else
JOptionPane.showMessageDialog(this, "添加失败");
}
} catch (SQLException ex) {
System.out.println(ex.toString());
}
d_Pass.myClose();
} catch (RuntimeException ex) {
JOptionPane.showMessageDialog(this, "权限是整型数字,1、2、3 ,重新输入!!!");
}
}
}
public void jButton4_actionPerformed(ActionEvent e) {
shuaxin(jTableT);
}
public void jButton1_actionPerformed(ActionEvent e) {
jtxNameX.setText("");
jtxPasswordX.setText("");
shuaxin(jTable1);
}
public void shuaxin(JTable jta)
{
String sql = "select * from quanxian ";
Dbcom dh = new Dbcom();
dh.search(sql);
String arry[] = new String[] {"权限??", "系统管理员权限", "一般管理员权限", "操作人员权限"};
int size = 0;
try {
while (dh.rs.next())
size++;
date = new Object[size][title.length];
boolean a = dh.rs.first();
for (int i = 0; a; i++) {
date[i][0] = dh.rs.getString(1).trim();
date[i][1] = dh.rs.getString(2).trim();
date[i][2] = arry[dh.rs.getInt(3)];
date[i][3] = new Boolean(dh.rs.getBoolean(4));
a = dh.rs.next();
}
DefaultTableModel model = new DefaultTableModel(date, title);
jta.setModel(model);
jta.updateUI();
} catch (SQLException ex) {
}
dh.myClose();
}
public void jTable1_mouseClicked(MouseEvent e) {
if(e.getButton()==e.BUTTON1)
{
// JOptionPane.showMessageDialog(null,""+jTable1.getValueAt(jTable1.getSelectedRow(),0));
if(jTable1.getSelectedRow()>=0){
if (jTable1.getValueAt(jTable1.getSelectedRow(), 0) != null) {
jtxNameX.setText(jTable1.getValueAt(jTable1.getSelectedRow(),0).toString());
jtxPasswordX.setText(jTable1.getValueAt(jTable1.getSelectedRow(),1).toString());
}
}
}
}
public void jButton5_actionPerformed(ActionEvent e) {
jtxNameX.setText("");
jtxPasswordX.setText("");
jRadioButton2.setSelected(true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -