• 大小: 25KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-26
  • 语言: Java
  • 标签:

资源简介

用java写的拉链法实现哈希表的建立,应用到类似于电话本查询的程序里,课程设计时候做的,所以不是很完美

资源截图

代码片段和文件信息

package haxi;
import javax.swing.*;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class Addrecord extends Jframe implements ActionListener{
//public class Addrecord extends Jframe{
JTextField user=new JTextField();
JTextField number=new JTextField();
JTextField adress=new JTextField();
JButton OKreset;
int length;
Record[] a;

public Addrecord(Record[] aint length){
JPanel pDown=new JPanel(new BorderLayout());
JPanel p1=new JPanel(new GridLayout(4212));
//JPanel p2=new JPanel(new GridLayout(42));
//setLayout(new GridLayout(42));
this.length=length;
this.a=a;
OK=new JButton(“确认“);
OK.setFont(new Font(“隶书“ Font.PLAIN 18));
OK.setActionCommand(“jbt5“);
OK.addActionListener(this);
reset=new JButton(“清空“);
reset.setFont(new Font(“隶书“ Font.PLAIN 18));
reset.setActionCommand(“jbt5“);
reset.addActionListener(this);
p1.add(new JLabel(“姓名:“));
p1.add(user);
p1.add(new JLabel(“电话号码:“));
p1.add(number);
p1.add(new JLabel(“地址:“));
p1.add(adress);
p1.add(reset);
p1.add(OK);
add(pDown);
pDown.add(p1BorderLayout.NORTH);
}

public Record[] getA(){
return a;
}
public int getL(){
return length;
}
public String getuser(){
return user.getText();
}

public String getnumber(){
return number.getText();
}

public String getadress(){
return adress.getText();
}

public void actionPerformed(ActionEvent e) {
if(e.getSource()==OK&&user.getText()!=null){ 
Fun f=new Fun();
length=f.Input(alengthuser.getText()number.getText()adress.getText());
//for(int i=0;i //System.out.println(“\n第“+(i+1)+“个用户信息:\n 姓 名:“+a[i].name+“\n 电话号码:“+a[i].tel+“\n 联系地址:“+a[i].add);
//JOptionPane.showMessageDialog(null “\n第“+(i+1)+“个用户信息:\n 姓 名:“+a[i].name+“\n 电话号码:“+a[i].tel+“\n 联系地址:“+a[i].add);
//f.ShowInformation(alength);
JOptionPane.showMessageDialog(null“添加成功“);
dispose();
return;
}
if(e.getSource()==reset){
user.setText(““);
number.setText(““);
adress.setText(““);
}
}
/*public static void main(String args[]){
 int length=0;
 Record[] b=null;
 Addrecord a=new Addrecord(blength);
 a.setSize(210160);
 a.settitle(“Calculation“);
 a.setResizable(false);
 a.setLocationRelativeTo(null);
 a.setVisible(true);
}*/

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-06-29 01:56  haxi\
     文件         301  2014-06-25 19:01  haxi\.classpath
     文件         380  2014-06-25 19:01  haxi\.project
     目录           0  2014-06-25 19:01  haxi\.settings\
     文件         598  2014-06-25 19:01  haxi\.settings\org.eclipse.jdt.core.prefs
     目录           0  2014-07-03 17:14  haxi\bin\
     目录           0  2014-07-03 17:14  haxi\bin\haxi\
     文件        2824  2014-07-03 17:14  haxi\bin\haxi\Addrecord.class
     文件        2288  2014-07-03 17:14  haxi\bin\haxi\DoubleSelect.class
     文件        2262  2014-07-03 17:14  haxi\bin\haxi\Fun.class
     文件         456  2014-07-03 17:14  haxi\bin\haxi\HashNode.class
     文件         952  2014-07-03 17:14  haxi\bin\haxi\HashTable.class
     文件         314  2014-07-03 17:14  haxi\bin\haxi\Number.class
     文件        1125  2014-07-03 17:14  haxi\bin\haxi\Record.class
     文件        3457  2014-07-03 17:14  haxi\bin\haxi\Select.class
     文件        1544  2014-07-03 17:14  haxi\bin\haxi\TextAreaPictureDemo$PictureArea.class
     文件        1693  2014-07-03 17:14  haxi\bin\haxi\TextAreaPictureDemo.class
     文件         646  2014-07-03 17:14  haxi\bin\haxi\zhujiemian$1.class
     文件        6187  2014-07-03 17:14  haxi\bin\haxi\zhujiemian.class
     目录           0  2014-06-25 20:04  haxi\src\
     目录           0  2014-06-29 01:59  haxi\src\haxi\
     文件        2558  2014-06-29 03:02  haxi\src\haxi\Addrecord.java
     文件        2079  2014-06-29 01:01  haxi\src\haxi\DoubleSelect.java
     文件        1468  2014-06-29 00:48  haxi\src\haxi\Fun.java
     文件         189  2014-06-28 19:50  haxi\src\haxi\HashNode.java
     文件         558  2014-06-28 00:32  haxi\src\haxi\HashTable.java
     文件         294  2014-06-27 02:17  haxi\src\haxi\Number.java
     文件         622  2014-06-26 23:22  haxi\src\haxi\Record.java
     文件        3630  2014-06-29 02:52  haxi\src\haxi\Select.java
     文件        2290  2014-06-29 02:24  haxi\src\haxi\TextAreaPictureDemo.java
     文件        4917  2014-06-29 03:01  haxi\src\haxi\zhujiemian.java
............此处省略0个文件信息

评论

共有 条评论