📄 ricgz.java
字号:
package soft1;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.border.*;
import com.borland.dbswing.*;
import com.borland.dx.dataset.*;
import com.borland.dx.sql.dataset.*;
import soft1Method.*;
import java.awt.Rectangle;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import java.util.Set;
import com.borland.dx.sql.dataset.Load;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Ricgz extends JPanel {
public Ricgz() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
setSize(new Dimension(562, 391));
this.addMouseListener(new Ricgz_this_mouseAdapter(this));
// jdbTree1=jtreemodel.jtree();
jTree1=jt.JTreeModel2();
jTree1.setBorder(null);
//jdbTree1.setColumnName("ID");
jTree1.setBounds(new Rectangle(7, 41, 129, 322));
jTree1.addMouseListener(new Ricgz_jdbTree1_mouseAdapter(this));
//jdbTree1.addContainerListener(new Ricgz_jdbTree1_containerAdapter(this));
//jdbTree1.setDataSet(queryDataSet1);
jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel1.setText("备注");
jLabel1.setBounds(new Rectangle(165, 133, 81, 23));
jButton5.setBounds(new Rectangle(175, 325, 81, 34));
jButton5.setText("新建");
jButton5.addActionListener(new Ricgz_jButton5_actionAdapter(this));
jButton6.setBounds(new Rectangle(470, 325, 78, 34));
jButton6.setText("删除");
jButton6.addActionListener(new Ricgz_jButton6_actionAdapter(this));
//jdbTextField1.setColumnName("Caption");
//jdbTextField1.setDataSet(queryDataSet1);
jTextField1.setBounds(new Rectangle(217, 41, 331, 27));
jComboBox1.setBounds(new Rectangle(217, 87, 82, 27));
jComboBox1.addFocusListener(new Ricgz_jdbComboBox1_focusAdapter(this));
jComboBox1.addActionListener(new Ricgz_jdbComboBox1_actionAdapter(this));
jComboBox1.addItem("无");
jComboBox1.addItem("重要");
jComboBox1.addItem("交付");
jComboBox1.addItem("电话");
jComboBox1.addItem("邮件");
jComboBox1.addItem("会议");
jComboBox1.addItem("出差");
jTextArea1.setBorder(BorderFactory.createEtchedBorder());
jTextArea1.setBounds(new Rectangle(165, 164, 383, 132));
jTextArea1.setLineWrap(true);
jButton1.setBounds(new Rectangle(319, 325, 81, 34));
jButton1.setText("保存");
jButton1.addActionListener(new Ricgz_jButton1_actionAdapter(this));
jLabel2.setFont(new java.awt.Font("黑体", Font.PLAIN, 14));
jLabel2.setText("记事详单");
jLabel2.setBounds(new Rectangle(7, 9, 99, 32));
column1.setColumnName("ID");
column1.setDataType(com.borland.dx.dataset.Variant.INT);
column1.setRowId(true);
column1.setServerColumnName("ID");
column1.setSqlType(4);
jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel3.setDisplayedMnemonic('0');
jLabel3.setText("主题:");
jLabel3.setBounds(new Rectangle(165, 41, 81, 27));
jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel4.setText("类型:");
jLabel4.setBounds(new Rectangle(165, 87, 74, 27));
jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel5.setText("日期时间:");
jLabel5.setBounds(new Rectangle(302, 128, 75, 28));
time.setBounds(new Rectangle(380, 128, 168, 28));
time.setBorder(titledBorder1);
time.setText("点击此处以选择日期");
jTextField2.setText("jdbTextField2");
jTextField2.setBounds(new Rectangle(0, 0, 0,0));
jTextField3.setVisible(false);
jTextField3.setBounds(new Rectangle(224, 131, 93, 20));
jButton2.setBounds(new Rectangle(302, 87, 246, 27));
jButton2.setText("找不到你要的类型?新建一个吧。");
jButton2.addActionListener(new Ricgz_jButton2_actionAdapter(this));
jButton3.setBounds(new Rectangle(439, 5, 109, 29));
jButton3.setBorder(titledBorder2);
jButton3.setText("整理类型");
jButton3.addActionListener(new Ricgz_jButton3_actionAdapter(this));
jdbTextField1.setVisible(false);
jdbTextField1.setText("jdbTextField1");
jdbTextField1.setBounds(new Rectangle(190, 14, 93, 20));
this.add(jTree1, null);
this.add(jLabel2, null);
this.add(jTextField1, null);
this.add(jTextArea1, null);
this.add(jComboBox1, null);this.add(jLabel3, null);
this.add(jLabel4, null);
this.add(jLabel1, null);
this.add(jButton6, null);
this.add(jButton1, null);
this.add(jButton5, null);
this.add(jTextField2);
this.add(jTextField3);
this.add(jLabel5, null);
this.add(time);
this.add(jButton2);
this.add(jButton3);
this.add(jdbTextField1);
DateChooserJButton datachooser=new DateChooserJButton();
}
GetValue getvalue=new GetValue();
JLabel jLabel1 = new JLabel();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
public JTextField jTextField1 = new JTextField();
public JComboBox jComboBox1 = new JComboBox();
public JTextArea jTextArea1 = new JTextArea();
JButton jButton1 = new JButton();
JLabel jLabel2 = new JLabel();
Column column1 = new Column();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JTree jTree1=new JTree();
DateChooserJButton datachooser=new DateChooserJButton();
JButton time=datachooser;
Dataset2 dt=new Dataset2();
GetValue gv=new GetValue(); JTreeModel jtreemodel=new JTreeModel();
JTreeModel2 jt=new JTreeModel2(); MiddleLoc midd=new MiddleLoc();
//JButton jButton2 = datachooser;
TitledBorder titledBorder1 = new TitledBorder("");
JTextField jTextField2 = new JdbTextField();
public static JTextField jTextField3 = new JTextField();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
TitledBorder titledBorder2 = new TitledBorder("");
JdbTextField jdbTextField1 = new JdbTextField();
public void jButton5_actionPerformed(ActionEvent e) {
Ricgz2 ricgz2=new Ricgz2();
System.out.println(getvalue.Getvalue());
midd.setLocation2(ricgz2);
}
public void jButton1_actionPerformed(ActionEvent e) throws SQLException,
ClassNotFoundException {
String date=time.getText();
jTextField2.setText(date);
System.out.print( jTextField2.getText());
String s="update WorkPad Set Caption='"+jTextField1.getText()+"',Sort='"+jComboBox1.getSelectedItem()+"',Mydate='"+time.getText()+"',Remarks='"+jTextArea1.getText()+"'"+
" where ID="+jdbTextField1.getText()+"";
System.out.println(s);
dt.Update(s);
dt.Getcon().close();
JOptionPane.showMessageDialog(this,"更新成功,请刷新!","提示",JOptionPane.PLAIN_MESSAGE);
}
public void jButton6_actionPerformed(ActionEvent e) {
try{
String s="DELETE FROM WorkPad where Caption='"+jTextField1.getText()+"'and UserName='"+gv.Getvalue()+"'";
System.out.println(s);
dt.Update(s);
dt.Getcon().close();
jTextField1.setText("");
jComboBox1.setSelectedIndex(0);
jTextArea1.setText("");
jTextField1.setText("");
JOptionPane.showMessageDialog(this,"删除成功,请刷新","提示",JOptionPane.ERROR_MESSAGE);
}catch(Exception ex){
JOptionPane.showMessageDialog(this,"删除失败","提示",JOptionPane.ERROR_MESSAGE);
}
}
public void jdbComboBox1_actionPerformed(ActionEvent e) {
}
public void jdbTree1_mouseClicked(MouseEvent e) throws
ClassNotFoundException, SQLException {
Object o= jTree1.getLastSelectedPathComponent();
String s1=String.valueOf(o);
String s2="select *from WorkPad where Caption='"+s1+"'and UserName='"+gv.Getvalue()+"'";
ResultSet rs= dt.Rs(s2);
//System.out.println(rs.next()); System.out.println(rs.getString("Caption")+"FSD");
while(rs.next()){ //System.out.println(rs.getString("Caption"));
jTextArea1.setText(rs.getString("Remarks"));
jTextField1.setText(rs.getString("Caption"));
jComboBox1.setSelectedItem(rs.getString("Sort"));
time.setText(rs.getString("Mydate"));
jdbTextField1.setText(rs.getString("ID"));
}
dt.Rs(s2).close();
dt.Getcon().close();
}
public void jdbComboBox1_focusGained(FocusEvent e) {
try{
jComboBox1.setSelectedItem(null);
jComboBox1.removeAllItems();
String sqlQuery="select Sort from WorkPadSort";
jComboBox1.addItem("");
ResultSet rs2=dt.Rs(sqlQuery);
while (rs2.next()) {
jComboBox1.addItem(rs2.getString(1));
}
dt.Getcon().close();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public void jButton2_actionPerformed(ActionEvent e) {
AddRicgz ad=new AddRicgz();
midd.setLocation2(ad);
}
public void jButton3_actionPerformed(ActionEvent e) {
CleanRicgz cr=new CleanRicgz();
midd.setLocation2(cr);
}
}
class Ricgz_jButton3_actionAdapter implements ActionListener {
private Ricgz adaptee;
Ricgz_jButton3_actionAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class Ricgz_jButton2_actionAdapter implements ActionListener {
private Ricgz adaptee;
Ricgz_jButton2_actionAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class Ricgz_jdbTree1_mouseAdapter extends MouseAdapter {
private Ricgz adaptee;
Ricgz_jdbTree1_mouseAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
try {
adaptee.jdbTree1_mouseClicked(e);
} catch (SQLException ex) {
} catch (ClassNotFoundException ex) {
}
}
}
class Ricgz_this_mouseAdapter extends MouseAdapter {
private Ricgz adaptee;
Ricgz_this_mouseAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
try {
adaptee.jdbTree1_mouseClicked(e);
} catch (SQLException ex) {
} catch (ClassNotFoundException ex) {
}
}
}
/*class Ricgz_jdbTree1_containerAdapter extends ContainerAdapter {
private Ricgz adaptee;
Ricgz_jdbTree1_containerAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}*/
/* public void componentAdded(ContainerEvent e) {
try {
adaptee.jdbTree1_componentAdded(e);
} catch (SQLException ex) {
} catch (ClassNotFoundException ex) {
}
}
}*/
class Ricgz_jdbComboBox1_actionAdapter implements ActionListener {
private Ricgz adaptee;
Ricgz_jdbComboBox1_actionAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jdbComboBox1_actionPerformed(e);
}
}
class Ricgz_jdbComboBox1_focusAdapter extends FocusAdapter {
private Ricgz adaptee;
Ricgz_jdbComboBox1_focusAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void focusGained(FocusEvent e) {
adaptee.jdbComboBox1_focusGained(e);
}
}
class Ricgz_jButton6_actionAdapter implements ActionListener {
private Ricgz adaptee;
Ricgz_jButton6_actionAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton6_actionPerformed(e);
}
}
class Ricgz_jButton1_actionAdapter implements ActionListener {
private Ricgz adaptee;
Ricgz_jButton1_actionAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
try {
adaptee.jButton1_actionPerformed(e);
} catch (ClassNotFoundException ex) {
} catch (SQLException ex) {
}
}
}
class Ricgz_jButton5_actionAdapter implements ActionListener {
private Ricgz adaptee;
Ricgz_jButton5_actionAdapter(Ricgz adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton5_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -