📄 txbsearch.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 javax.swing.border.TitledBorder;
import javax.swing.BorderFactory;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import soft1Method.*;
import javax.swing.border.Border;
import java.sql.SQLException;
public class TxbSearch extends JPanel {
XYLayout xYLayout1 = new XYLayout();
public static JTextField jTextField1 = new JTextField();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
JRadioButton jRadioButton2 = new JRadioButton();
JRadioButton jRadioButton3 = new JRadioButton();
JRadioButton jRadioButton4 = new JRadioButton();
JRadioButton jRadioButton5 = new JRadioButton();
TitledBorder titledBorder1 = new TitledBorder("");
ButtonGroup gr=new ButtonGroup();
Dataset2 dt=new Dataset2();
GetValue gv=new GetValue();
MiddleLoc ml=new MiddleLoc();
RatioBMethod rb=new RatioBMethod();
TitledBorder titledBorder2 = new TitledBorder("");
Border border1 = BorderFactory.createEtchedBorder(Color.white,
new Color(170, 170, 170));
Border border2 = BorderFactory.createCompoundBorder(border1, titledBorder2);
TitledBorder titledBorder3 = new TitledBorder("");
JRadioButton jRadioButton1 = new JRadioButton();
public String s;
public TxbSearch() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(xYLayout1);
this.setBackground(UIManager.getColor("Button.disabledForeground"));
setSize(new Dimension(562, 391));
jButton1.setBorder(titledBorder1);
jButton1.setIcon(null);
jButton1.setText("搜索");
jButton1.addActionListener(new TxbSearch_jButton1_actionAdapter(this));
jLabel1.setFont(new java.awt.Font("华文细黑", Font.BOLD, 18));
jLabel1.setText("通讯簿搜索");
jRadioButton2.setText("家庭电话");
jRadioButton3.setText("移动电话");
jRadioButton4.setText("办公电话");
jRadioButton5.setText("QQ");
jRadioButton1.setText("姓名");
this.add(jTextField1, new XYConstraints(114, 138, 289, 37));
this.add(jLabel1, new XYConstraints(205, 48, 155, 47));
this.add(jRadioButton3, new XYConstraints(230, 202, -1, -1));
this.add(jRadioButton1, new XYConstraints(108, 202, 52, -1));
this.add(jRadioButton2, new XYConstraints(159, 202, -1, -1));
this.add(jRadioButton4, new XYConstraints(302, 202, -1, -1));
this.add(jRadioButton5, new XYConstraints(374, 202, -1, -1));
gr.add(jRadioButton2);
gr.add(jRadioButton3);
gr.add(jRadioButton4);
gr.add(jRadioButton5);
gr.add(jRadioButton1);
this.add(jButton1, new XYConstraints(407, 138, 100, 37));
}
public void jButton1_actionPerformed(ActionEvent e) throws
ClassNotFoundException, SQLException {
if(jTextField1.getText().equals("")){
JOptionPane.showMessageDialog(this,"您还没写搜索内容!","提示",JOptionPane.PLAIN_MESSAGE);
}
else if(!jRadioButton1.isSelected() && !jRadioButton2.isSelected()&& !jRadioButton3.isSelected()
&& !jRadioButton4.isSelected()&& !jRadioButton5.isSelected()){
JOptionPane.showMessageDialog(this,"您还没选择搜索项!","提示",JOptionPane.PLAIN_MESSAGE);
}
else{
rb.RatioSlt(jRadioButton1,jTextField1.getText(),"Name");
rb.RatioSlt(jRadioButton2,jTextField1.getText(),"HomePho");
rb.RatioSlt(jRadioButton3,jTextField1.getText(),"MobilePho");
rb.RatioSlt(jRadioButton4,jTextField1.getText(),"OfficePho");
rb.RatioSlt(jRadioButton5,jTextField1.getText(),"QQ");
}
}
}
class TxbSearch_jButton1_actionAdapter implements ActionListener {
private TxbSearch adaptee;
TxbSearch_jButton1_actionAdapter(TxbSearch 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 + -