📄 zclbview.java~3~
字号:
package zcgl;
import java.awt.BorderLayout;
import java.awt.*;
import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Rectangle;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2008</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ZcLbView extends JFrame {
JPanel jPanel1 = new JPanel();
JLabel jLabel1 = new JLabel();
JTextField txtZlId = new JTextField();
JLabel jLabel2 = new JLabel();
JTextField txtZlName = new JTextField();
JLabel jLabel3 = new JLabel();
JTextField txtSubId = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField txtSubName = new JTextField();
JButton btnAdd = new JButton();
JButton btnModify = new JButton();
JButton jButton1 = new JButton();
JButton btnDel = new JButton();
public ZcLbView() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
jPanel1.setBorder(BorderFactory.createEtchedBorder());
jPanel1.setBounds(new Rectangle(54, 23, 291, 195));
jPanel1.setLayout(null);
jLabel2.setText("主类名称");
jLabel2.setBounds(new Rectangle(39, 76, 51, 15));
txtZlName.setBounds(new Rectangle(97, 73, 121, 21));
jLabel3.setText("子类编号");
jLabel3.setBounds(new Rectangle(39, 117, 58, 15));
txtSubId.setBounds(new Rectangle(96, 113, 120, 21));
txtZlId.setBounds(new Rectangle(96, 33, 121, 21));
jLabel4.setText("子类名称");
jLabel4.setBounds(new Rectangle(40, 160, 50, 15));
txtSubName.setBounds(new Rectangle(95, 157, 120, 21));
btnAdd.setBounds(new Rectangle(22, 245, 83, 25));
btnAdd.setText("添加");
btnAdd.addActionListener(new ZcLbView_btnAdd_actionAdapter(this));
btnModify.setBounds(new Rectangle(113, 245, 83, 25));
btnModify.setText("修改");
jButton1.setBounds(new Rectangle(304, 245, 83, 25));
jButton1.setText("查询");
btnDel.setBounds(new Rectangle(212, 246, 83, 25));
btnDel.setText("删除");
jPanel1.add(jLabel1);
jPanel1.add(txtZlId);
jPanel1.add(jLabel2);
jPanel1.add(txtZlName);
jPanel1.add(jLabel3);
jPanel1.add(txtSubId);
jPanel1.add(jLabel4);
jPanel1.add(txtSubName);
this.getContentPane().add(jButton1);
this.getContentPane().add(btnAdd);
this.getContentPane().add(btnModify);
this.getContentPane().add(btnDel);
this.getContentPane().add(jPanel1, null);
jLabel1.setText("主类编号");
jLabel1.setBounds(new Rectangle(38, 35, 59, 15));
}
public void btnAdd_actionPerformed(ActionEvent e) throws HeadlessException,
ClassNotFoundException {
ZcLbBean bean = new ZcLbBean();
bean.setZlId(Integer.parseInt(txtZlId.getText()));
bean.setZlName(txtZlName.getText());
bean.setSubId(Integer.parseInt(txtSubId.getText()));
bean.setSubName(txtSubName.getText());
if (bean.insert()) {
JOptionPane.showMessageDialog(this, "插入成功!");
} else {
JOptionPane.showMessageDialog(this, "插入失败!");
}
}
}
class ZcLbView_btnAdd_actionAdapter implements ActionListener {
private ZcLbView adaptee;
ZcLbView_btnAdd_actionAdapter(ZcLbView adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
try
{
adaptee.btnAdd_actionPerformed(e);
}
catch(Exception ex)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -