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

📄 mainframe.java

📁 一个java的数据挖掘程序,实现关键字的搜索分类
💻 JAVA
字号:
package search;import java.awt.*;import javax.swing.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class MainFrame extends JFrame {  JScrollPane jScrollPane1 = new JScrollPane();  JPanel jPanel1 = new JPanel();  JRadioButton jRadioButton1 = new JRadioButton();  JRadioButton jRadioButton2 = new JRadioButton();  JTextField jTextField1 = new JTextField();  JButton jButton1 = new JButton();  static JTextArea JTextArea1 = new JTextArea();  JLabel jLabel1 = new JLabel();  JLabel jLabel2 = new JLabel();  JTextField jTextField3 = new JTextField();  JLabel jLabel3 = new JLabel();  JTextField jTextField4 = new JTextField();  ButtonGroup buttonGroup1 = new ButtonGroup();  public MainFrame() throws HeadlessException {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  public static void main(String[] args) throws HeadlessException {    try{      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());    }    catch(Exception e){}    MainFrame mainFrame1 = new MainFrame();    mainFrame1.show();  }  private void jbInit() throws Exception {    this.getContentPane().setLayout(null);    this.setLocale(java.util.Locale.getDefault());    this.setResizable(false);    this.setTitle("搜索");    this.setBounds(new Rectangle(300, 200, 400, 365));    jScrollPane1.setBounds(new Rectangle(0, 0, 392, 211));    jPanel1.setBounds(new Rectangle(0, 218, 391, 89));    jPanel1.setLayout(null);    jRadioButton1.setText("Web搜索");    jRadioButton1.setBounds(new Rectangle(62, 0, 91, 25));    jRadioButton1.addActionListener(new MainFrame_jRadioButton1_actionAdapter(this));    jRadioButton2.setToolTipText("");    jRadioButton2.setText("本地文件搜索");    jRadioButton2.setBounds(new Rectangle(208, 0, 108, 25));    jRadioButton2.addActionListener(new MainFrame_jRadioButton2_actionAdapter(this));    jRadioButton2.setSelected(true);    jTextField3.setToolTipText("");    jTextField3.setEditable(false);    jTextField3.setText("");    buttonGroup1.add(jRadioButton1);    buttonGroup1.add(jRadioButton2);    jTextField1.setText("123");    jTextField1.setBounds(new Rectangle(75, 33, 122, 22));    jButton1.setBounds(new Rectangle(299, 309, 85, 25));    jButton1.setToolTipText("");    jButton1.setText("搜索");    jButton1.addActionListener(new MainFrame_jButton1_actionAdapter(this));    JTextArea1.setCaretColor(Color.black);    JTextArea1.setEditable(false);    jLabel1.setVerifyInputWhenFocusTarget(true);    jLabel1.setText("搜索字符串:");    jLabel1.setBounds(new Rectangle(4, 39, 68, 16));    jLabel2.setToolTipText("");    jLabel2.setText("数目:");    jLabel2.setBounds(new Rectangle(228, 36, 34, 16));    jTextField3.setBounds(new Rectangle(283, 33, 101, 22));    jLabel3.setText("位置(网址):");    jLabel3.setBounds(new Rectangle(4, 70, 69, 16));    jTextField4.setText("c:/test");    jTextField4.setBounds(new Rectangle(74, 66, 310, 22));    this.getContentPane().add(jScrollPane1, null);    jScrollPane1.getViewport().add(JTextArea1, null);    this.getContentPane().add(jPanel1, null);    jPanel1.add(jRadioButton1, null);    jPanel1.add(jTextField4, null);    jPanel1.add(jLabel2, null);    jPanel1.add(jTextField1, null);    jPanel1.add(jTextField3, null);    jPanel1.add(jLabel3, null);    jPanel1.add(jLabel1, null);    jPanel1.add(jRadioButton2, null);    this.getContentPane().add(jButton1, null);  }  void jButton1_actionPerformed(ActionEvent e) {    String searchString=jTextField1.getText();    int Maxcount=20;    if(!jTextField3.getText().equals(""))      Maxcount=Integer.parseInt(jTextField3.getText());    String URL=jTextField4.getText();    if(jRadioButton1.isSelected()){      SearchHTTPFile shf=new SearchHTTPFile(URL,Maxcount,searchString);      Thread  search=new Thread(shf);      search.start();    }    else {      SearchLocalFile slf=new SearchLocalFile(URL,searchString);      Thread  search=new Thread(slf);      search.start();    }  }  public static void display(String s){    JTextArea1.append(s);  }  void jRadioButton1_actionPerformed(ActionEvent e) {    jTextField1.setText("学校");    jTextField3.setEditable(true);    jTextField3.setText("20");    jTextField4.setText("http://www.163.com");  }  void jRadioButton2_actionPerformed(ActionEvent e) {    jTextField1.setText("123");    jTextField3.setText("");    jTextField3.setEditable(false);    jTextField4.setText("c:/test");  }}class MainFrame_jButton1_actionAdapter implements java.awt.event.ActionListener {  MainFrame adaptee;  MainFrame_jButton1_actionAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}class MainFrame_jRadioButton1_actionAdapter implements java.awt.event.ActionListener {  MainFrame adaptee;  MainFrame_jRadioButton1_actionAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jRadioButton1_actionPerformed(e);  }}class MainFrame_jRadioButton2_actionAdapter implements java.awt.event.ActionListener {  MainFrame adaptee;  MainFrame_jRadioButton2_actionAdapter(MainFrame adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jRadioButton2_actionPerformed(e);  }}

⌨️ 快捷键说明

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