主题:程序出错提示:找不到符号
class Content
{
String names;
String position;
String department;
String name;
String type;
public Content(){}
构造函数省略
}
interface display{
int i=0;
public void display();
}
public class InforFound extends WindowAdapter implements ActionListener,
ItemListener
{ Frame f;
TextField tf1, tf2, tf3, tf4;
Button b1, b2, b3, b4;
List l;
Content content[] = new Content[3];
public InforFound()
{
content[0] = new Content();
f = new Frame("信息查询系统");
f.setSize(640, 480);
Panel p = new Panel();
p.add(new Label("学校:"));
tf1 = new TextField(10);
p.add(tf1);
p.add(new Label("单位:"));
tf2 = new TextField(10);
p.add(tf2);
p.add(new Label("部门:"));
tf3 = new TextField(10);
p.add(tf3);
p.add(new Label("教师:"));
tf4 = new TextField(10);
p.add(tf4);
f.add("North",p);
b1 = new Button("教师信息查询");
b2 = new Button("教师学校信息查询");
b3 = new Button("学校信息查询");
b4 = new Button("部门信息查询");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Panel p3 = new Panel();
p3.add(b1);
p3.add(b2);
p3.add(b3);
p3.add(b4);
f.add("South",p3);
l = new List();
l.add("您要查询的信息如下:");
l.addItemListener(this);
f.add(l);
f.setVisible(true);
f.addWindowListener(this);
content[0].setcontent("xx", "xx", "xx",
"xx", "xx");}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == b1)
{
f.setVisible(true);
displaymentb1 d1=new displaymentb1();
}
if (e.getSource() == b2)
{
f.setVisible(true);
displaymentb2 d2=new displaymentb2();
}
if (e.getSource() == b3)
{
f.setVisible(true);
displaymentb3 d3=new displaymentb3();
}
if (e.getSource() == b4)
{
f.setVisible(true);
displaymentb4 d4=new displaymentb4();
}
}
public static void main(String args[])
{
new InforFound();
}
public void itemStateChanged(ItemEvent e){}
//实现条目状态改变
public void windowClosing(WindowEvent e)
{
//实现窗口关闭
System.exit(0);
}
}
class displaymentb3 implements display
{
public void display()
{
for (i = 0; i < content.length; i++)
{
if (tf1.getText().equals(content[i].getname()))
l.add(content[i].getname()+" "+content[i].getdepartment());
}
if (i > content.length)
l.add("您要查找的信息不存在");
}
}
class diplaymentb4 implements display
{
public void display()
{
int i;
for (i = 0; i < content.length; i++)
{
if (tf2.getText().equals(content[i].getposition()) && tf3.getText().equals(content[i].getdepartment()))
l.add(content[i].getnames()+" "+content[i].getposition()+" "+content[i].getdepartment());
}
if (i > content.length)
l.add("您要查找的信息不存在");
}
}
class diplaymentb2 implements display
{
public void display()
{
int i;
for (i = 0; i < content.length; i++)
{
if (tf4.getText().equals(content[i].getnames()) && tf1.getText().equals(content[i].getname()))
l.add(content[i].getname()+" "+content[i].gettype()+" "+content[i].getnames()+" "+content[i].getposition()+" "+content[i].getdepartment());
}
if (i > content.length)
l.add("您要查找的信息不存在");
}
}
class diplaymentb1 implements display
{
public void display()
{
int i;
for (i = 0; i < content.length; i++)
{
if (tf4.getText().equals(content[i].getnames()))
l.add(content[i].getname()+" "+content[i].gettype()+" " +content[i].getnames()+" "+content[i].getposition()+" "+content[i].getdepartment()); }
if (i > content.length)
l.add("您要查找的信息不存在");
}}
{
String names;
String position;
String department;
String name;
String type;
public Content(){}
构造函数省略
}
interface display{
int i=0;
public void display();
}
public class InforFound extends WindowAdapter implements ActionListener,
ItemListener
{ Frame f;
TextField tf1, tf2, tf3, tf4;
Button b1, b2, b3, b4;
List l;
Content content[] = new Content[3];
public InforFound()
{
content[0] = new Content();
f = new Frame("信息查询系统");
f.setSize(640, 480);
Panel p = new Panel();
p.add(new Label("学校:"));
tf1 = new TextField(10);
p.add(tf1);
p.add(new Label("单位:"));
tf2 = new TextField(10);
p.add(tf2);
p.add(new Label("部门:"));
tf3 = new TextField(10);
p.add(tf3);
p.add(new Label("教师:"));
tf4 = new TextField(10);
p.add(tf4);
f.add("North",p);
b1 = new Button("教师信息查询");
b2 = new Button("教师学校信息查询");
b3 = new Button("学校信息查询");
b4 = new Button("部门信息查询");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Panel p3 = new Panel();
p3.add(b1);
p3.add(b2);
p3.add(b3);
p3.add(b4);
f.add("South",p3);
l = new List();
l.add("您要查询的信息如下:");
l.addItemListener(this);
f.add(l);
f.setVisible(true);
f.addWindowListener(this);
content[0].setcontent("xx", "xx", "xx",
"xx", "xx");}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == b1)
{
f.setVisible(true);
displaymentb1 d1=new displaymentb1();
}
if (e.getSource() == b2)
{
f.setVisible(true);
displaymentb2 d2=new displaymentb2();
}
if (e.getSource() == b3)
{
f.setVisible(true);
displaymentb3 d3=new displaymentb3();
}
if (e.getSource() == b4)
{
f.setVisible(true);
displaymentb4 d4=new displaymentb4();
}
}
public static void main(String args[])
{
new InforFound();
}
public void itemStateChanged(ItemEvent e){}
//实现条目状态改变
public void windowClosing(WindowEvent e)
{
//实现窗口关闭
System.exit(0);
}
}
class displaymentb3 implements display
{
public void display()
{
for (i = 0; i < content.length; i++)
{
if (tf1.getText().equals(content[i].getname()))
l.add(content[i].getname()+" "+content[i].getdepartment());
}
if (i > content.length)
l.add("您要查找的信息不存在");
}
}
class diplaymentb4 implements display
{
public void display()
{
int i;
for (i = 0; i < content.length; i++)
{
if (tf2.getText().equals(content[i].getposition()) && tf3.getText().equals(content[i].getdepartment()))
l.add(content[i].getnames()+" "+content[i].getposition()+" "+content[i].getdepartment());
}
if (i > content.length)
l.add("您要查找的信息不存在");
}
}
class diplaymentb2 implements display
{
public void display()
{
int i;
for (i = 0; i < content.length; i++)
{
if (tf4.getText().equals(content[i].getnames()) && tf1.getText().equals(content[i].getname()))
l.add(content[i].getname()+" "+content[i].gettype()+" "+content[i].getnames()+" "+content[i].getposition()+" "+content[i].getdepartment());
}
if (i > content.length)
l.add("您要查找的信息不存在");
}
}
class diplaymentb1 implements display
{
public void display()
{
int i;
for (i = 0; i < content.length; i++)
{
if (tf4.getText().equals(content[i].getnames()))
l.add(content[i].getname()+" "+content[i].gettype()+" " +content[i].getnames()+" "+content[i].getposition()+" "+content[i].getdepartment()); }
if (i > content.length)
l.add("您要查找的信息不存在");
}}