📄 othersearch.java
字号:
package soft1;
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import soft1Method.*;
import java.sql.SQLException;
public class OtherSearch extends JPanel {
XYLayout xYLayout1 = new XYLayout();
JComboBox jComboBox1 = new JComboBox();
public static JTextField jTextField1 = new JTextField();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
MiddleLoc ml=new MiddleLoc();Dataset2 dt=new Dataset2();
GetValue gv=new GetValue();
// public static String s;
public OtherSearch() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(xYLayout1);
this.setBackground(UIManager.getColor(
"InternalFrame.activeTitleBackground"));
setSize(new Dimension(562, 391));
jButton1.setText("确定");
jButton1.addActionListener(new OtherSearch_jButton1_actionAdapter(this));
jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
jLabel1.setText("全局搜索");
jLabel2.setText("选择搜索范围");
jComboBox1.addItem("日常工作");
jComboBox1.addItem("生活琐事");
this.add(jLabel1, new XYConstraints(230, 78, 63, 37));
this.add(jButton1, new XYConstraints(422, 166, 84, 31));
this.add(jComboBox1, new XYConstraints(98, 166, 90, 31));
this.add(jTextField1, new XYConstraints(195, 166, 220, 31));
this.add(jLabel2, new XYConstraints(98, 115, 107, 39));
}
public void jButton1_actionPerformed(ActionEvent e) throws
ClassNotFoundException, SQLException {
if(jTextField1.getText().equals("")){
JOptionPane.showMessageDialog(this,"您还没写搜索内容!","提示",JOptionPane.PLAIN_MESSAGE);
}
else{
if(jComboBox1.getSelectedItem().equals("日常工作")){
String sql1="select * from WorkPad where UserName='"+gv.Getvalue()+"' and Caption like '%"+jTextField1.getText()+"%'";
System.out.println(sql1);
if(dt.Rs(sql1).next()){ RicgzSearch rh=new RicgzSearch();
ml.setLocation1(rh);}
else{
JOptionPane.showMessageDialog(this,"无相应内容!","提示",JOptionPane.PLAIN_MESSAGE);
}
}
else{
String sql2="select * from NotePad where UserName='"+gv.Getvalue()+"' and Caption like '%"+jTextField1.getText()+"%'";
if(dt.Rs(sql2).next()){ ShssSearch ss=new ShssSearch();
ml.setLocation1(ss);}
else{
JOptionPane.showMessageDialog(this,"无相应内容!","提示",JOptionPane.PLAIN_MESSAGE);
}
}
}
}
}
class OtherSearch_jButton1_actionAdapter implements ActionListener {
private OtherSearch adaptee;
OtherSearch_jButton1_actionAdapter(OtherSearch adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
try {
adaptee.jButton1_actionPerformed(e);
} catch (SQLException ex) {
} catch (ClassNotFoundException ex) {
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -