📄 ljb_show.java
字号:
package LJB;/** */import com.zdsoft.gui.*;import com.zdsoft.datacenter.ASDatacenter;import com.zdsoft.datastore.ASDatastore;import javax.swing.*;import java.awt.*;import java.awt.event.*;import ZQ.*;public class LJB_show extends ASPanel{ JPanel jPanel1 = new JPanel(); JPanel jPanel2 = new JPanel(); JPanel jPanel3 = new JPanel(); JLabel jLabel1 = new JLabel(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JButton jButton3 = new JButton(); JScrollPane jScrollPane1 = new JScrollPane(); ASTable jTable1; ASDatastore ds; JButton jButton4 = new JButton(); public LJB_show() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception {ASDatacenter dc = new ASDatacenter();dc.connect();String sql = "select * from banji_dm";ds = dc.retrieve(sql);String[] liab = new String[3];liab[0] = "班级号码";liab[1] = "班级名称";liab[2] = "班主任";ds.setTitleLable(liab);ASTableView tv = new ASTableView(ds);jTable1 = new ASTable(tv);dc.disconnect(); jLabel1.setFont(new java.awt.Font("Serif", 0, 20)); jLabel1.setForeground(Color.red); jLabel1.setText("班级信息基本维护"); jButton1.setFont(new java.awt.Font("Serif", 0, 12)); jButton1.setText("删除"); jButton1.addActionListener(new LJB_show_jButton1_actionAdapter(this)); jButton2.setFont(new java.awt.Font("Serif", 0, 12)); jButton2.setText("修改"); jButton2.addActionListener(new LJB_show_jButton2_actionAdapter(this)); jButton3.setFont(new java.awt.Font("Serif", 0, 12)); jButton3.setVerifyInputWhenFocusTarget(true); jButton3.setText("增加"); jButton3.addActionListener(new LJB_show_jButton3_actionAdapter(this)); this.setPreferredSize(new Dimension(600, 600)); jScrollPane1.setPreferredSize(new Dimension(550, 350)); jButton4.setFont(new java.awt.Font("Serif", 0, 12)); jButton4.setText("图片"); jButton4.addActionListener(new LJB_show_jButton4_actionAdapter(this)); this.add(jPanel1, BorderLayout.CENTER); jPanel1.add(jScrollPane1, null); jScrollPane1.getViewport().add(jTable1, null); this.add(jPanel2, BorderLayout.SOUTH); jPanel2.add(jButton3, null); jPanel2.add(jButton2, null); jPanel2.add(jButton1, null); jPanel2.add(jButton4, null); this.add(jPanel3, BorderLayout.NORTH); jPanel3.add(jLabel1, null); } void jButton3_actionPerformed(ActionEvent e) { LJB_add md = new LJB_add(this); md.show(); } void jButton2_actionPerformed(ActionEvent e) { int i = jTable1.getSelectedRow(); if(i==-1){ JOptionPane.showMessageDialog(this, "请选择要修改的数据!", "提示信息", JOptionPane.ERROR_MESSAGE); } else{ LJB_mod md = new LJB_mod(this); md.show(); } } void jButton1_actionPerformed(ActionEvent e) { int i = jTable1.getSelectedRow(); if(i==-1){ JOptionPane.showMessageDialog(this, "请选择要删除的数据!", "提示信息", JOptionPane.ERROR_MESSAGE); } else{ try { int xh = ds.getItemInteger(i,"bj_id").intValue(); String sql = "delete banji_dm where bj_id="+xh; ASDatacenter dc = new ASDatacenter(); dc.connect(); String[] msg = dc.update(sql); if(msg[0].equals("true")){ ds.removeRow(i); jTable1.ASTableRepant(); } else{} dc.disconnect(); } catch (Exception ex) { } } } void jButton4_actionPerformed(ActionEvent e) { ZQ_tupian tp = new ZQ_tupian(this); tp.show(); }}class LJB_show_jButton3_actionAdapter implements java.awt.event.ActionListener { LJB_show adaptee; LJB_show_jButton3_actionAdapter(LJB_show adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton3_actionPerformed(e); }}class LJB_show_jButton2_actionAdapter implements java.awt.event.ActionListener { LJB_show adaptee; LJB_show_jButton2_actionAdapter(LJB_show adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton2_actionPerformed(e); }}class LJB_show_jButton1_actionAdapter implements java.awt.event.ActionListener { LJB_show adaptee; LJB_show_jButton1_actionAdapter(LJB_show adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}class LJB_show_jButton4_actionAdapter implements java.awt.event.ActionListener { LJB_show adaptee; LJB_show_jButton4_actionAdapter(LJB_show adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton4_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -