⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ricgz2.java

📁 一个个人信息管理系统
💻 JAVA
字号:
package soft1;

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.*;
import com.borland.dx.sql.dataset.*;
import com.borland.dx.dataset.*;
import java.awt.event.*;
import javax.swing.border.TitledBorder;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.Load;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dx.sql.dataset.Database;
import com.borland.dx.sql.dataset.QueryDataSet;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.Load;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dx.dataset.Column;
import soft1Method.*;
import java.sql.SQLException;
import java.awt.Font;
import java.sql.ResultSet;
import javax.swing.tree.DefaultMutableTreeNode;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Ricgz2 extends JDialog {
    public Ricgz2(Frame owner, String title, boolean modal) {
        super(owner, title, modal);
        try {
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            jbInit();
            pack();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    public Ricgz2() {
        this(new Frame(), "Ricgz", true);
    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(xYLayout1);
        jButton2.setText("重置");
        jButton2.addActionListener(new Ricgz2_jButton2_actionAdapter(this));
        jButton6.setText("返回");
        jButton6.addActionListener(new Ricgz2_jButton6_actionAdapter(this));
        xYLayout1.setWidth(381);
        xYLayout1.setHeight(283);
        this.setTitle("新建记事");
        column1.setColumnName("ID");
        column1.setDataType(com.borland.dx.dataset.Variant.INT);
        column1.setRowId(true);
        column1.setTableName("WorkPad");
        column1.setServerColumnName("ID");
        column1.setSqlType(4);
        jPanel1.setLayout(xYLayout2);
        jdbTextField1.setColumnName("Caption");
        jdbComboBox1.setColumnName("Sort");
        jdbComboBox1.addItem("无");
        jdbComboBox1.addItem("重要");
        jdbComboBox1.addItem("交付");
        jdbComboBox1.addItem("电话");
        jdbComboBox1.addItem("邮件");
        jdbComboBox1.addItem("会议");
        jdbComboBox1.addItem("出差");
        jdbComboBox1.setSelectedIndex(0);
        jdbTextArea1.setToolTipText("");
        jdbTextArea1.setText("备注");
        jdbTextArea1.setColumnName("Remarks");
        jButton1.addActionListener(new Ricgz2_jButton1_actionAdapter(this));
        jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jLabel1.setText("主题:");
        jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jLabel2.setText("类型:");
        jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jLabel3.setText("日期:");
        jButton3.setText("jButton3");
        jPanel1.add(jButton2, new XYConstraints(64, 237, -1, -1));
        jPanel1.add(jButton1, new XYConstraints(167, 237, -1, -1));
        jPanel1.add(jButton6, new XYConstraints(267, 237, -1, -1));
        jPanel1.add(jdbTextArea1, new XYConstraints(33, 121, 327, 100));
        this.getContentPane().add(jPanel1, new XYConstraints( -10, 0, 763, 284));
        jPanel1.add(jLabel1, new XYConstraints(33, 29, 58, 23));
        jPanel1.add(jLabel2, new XYConstraints(33, 75, 57, 22));
        jPanel1.add(jLabel3, new XYConstraints(177, 74, 68, 23));
        jPanel1.add(jdbTextField1, new XYConstraints(83, 29, 277, 23));
        jPanel1.add(jdbComboBox1, new XYConstraints(83, 74, 85, -1));
        jPanel1.add(jButton3, new XYConstraints(224, 74, 136, 23));
        jButton1.setText("确认");
    }
    public static String UserName2;

    XYLayout xYLayout1 = new XYLayout();
    TitledBorder titledBorder1 = new TitledBorder("");
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JButton jButton6 = new JButton();
    Column column1 = new Column();
    JPanel jPanel1 = new JPanel();
    XYLayout xYLayout2 = new XYLayout();
    JdbTextField jdbTextField1 = new JdbTextField();
    JdbComboBox jdbComboBox1 = new JdbComboBox();
    JdbTextArea jdbTextArea1 = new JdbTextArea();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    Dataset2 dataset2=new Dataset2(); GetValue getvalue=new GetValue();
    DateChooserJButton2 dcj=new DateChooserJButton2();
    JButton jButton3 =dcj;
    public void jButton2_actionPerformed(ActionEvent e) {
        jButton3.setText("");
        jdbTextField1.setText("");
        jdbComboBox1.setSelectedIndex(0);
        jdbTextArea1.setText("");
    }

    public void jButton6_actionPerformed(ActionEvent e) {
    this.setVisible(false);
    }

    public void jButton1_actionPerformed(ActionEvent e) throws SQLException,
            ClassNotFoundException {
        if(jdbTextField1.getText().equals("")){
         JOptionPane.showMessageDialog(this,"请输入主题!","提示",JOptionPane.PLAIN_MESSAGE);
        }
        else{
         String s="SELECT * from WorkPad where Caption='"+jdbTextField1.getText()+"'and UserName='"+getvalue.Getvalue()+"'";
         System.out.println(s);
         System.out.println(dataset2.Rs(s));
         ResultSet rs=dataset2.Rs(s);
         if(!rs.next()){
             String sql="insert into WorkPad(Sort,Caption,Remarks,UserName,Mydate) values ('"+jdbComboBox1.getSelectedItem()+"','"+jdbTextField1.getText()+"','"+jdbTextArea1.getText()+"','"+getvalue.Getvalue()+"','"+jButton3.getText()+"')";
             System.out.print(sql);
             dataset2.Update(sql);

             JOptionPane.showMessageDialog(this,"添加成功,请刷新!","提示",JOptionPane.PLAIN_MESSAGE);

         }
         else{

         JOptionPane.showMessageDialog(this,"该主题已存在,请另起主题名!","提示",JOptionPane.PLAIN_MESSAGE);
         }
    }}
}


class Ricgz2_jButton1_actionAdapter implements ActionListener {
    private Ricgz2 adaptee;
    Ricgz2_jButton1_actionAdapter(Ricgz2 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        try {
            adaptee.jButton1_actionPerformed(e);
        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }
    }
}


class Ricgz2_jButton6_actionAdapter implements ActionListener {
    private Ricgz2 adaptee;
    Ricgz2_jButton6_actionAdapter(Ricgz2 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton6_actionPerformed(e);
    }
}


class Ricgz2_jButton2_actionAdapter implements ActionListener {
    private Ricgz2 adaptee;
    Ricgz2_jButton2_actionAdapter(Ricgz2 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton2_actionPerformed(e);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -