请大家帮我看看我写的程序啊!
这是我写好的程序,但是为什么在运行出来的时候我在jt1和jt2里面输入了数字之后为什么在jt3里没有反应啊!没有达到我的预期效果啊!
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.util.ArrayList.*;
import java.util.*;
public class Xingzuo extends JFrame{
private JLabel jl1 = new JLabel( "月 ");
private JLabel jl2 = new JLabel( "日 ");
private JLabel jl3 = new JLabel( "星座 ");
private JTextField
jt1 = new JTextField(15),
jt2 = new JTextField(15),
jt3 = new JTextField(15);
private JPanel panel = new JPanel();
int[] a = new int[20];
java.util.List <Integer> b = new ArrayList <Integer> ();
int[] c = new int[30];
public Xingzuo(String title){
super(title);
panel.setLayout(new FlowLayout()) ;
panel.add(jl1);
panel.add(jt1);
panel.add(jl2);
panel.add(jt2);
panel.add(jl3);
panel.add(jt3);
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.add(panel);
jt1.addActionListener(new ActionListener1());
jt2.addActionListener(new ActionListener2());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setSize(800,200);
setVisible(true);
}
class ActionListener1 implements ActionListener{
public void actionPerformed(ActionEvent event){
for(int i=1;i <=12;i++)
a[i-1]=i;
}
} //我想可能是事件的处理问题吧!
class ActionListener2 implements ActionListener{
public void actionPerformed(ActionEvent e){
Iterator it = b.iterator();
for(int j=1;j <=21;j++){
c[j-1]=j;
b.add(new Integer(c[j-1]));
}
if(jt1.getText().equals(new Integer(a[0]))){
while(it.hasNext()){
if(jt2.getText().equals(it.next()))
jt3.setText( "mijie ");
}
jt3.setText( "shuiping ");
}
else
if(jt1.getText().equals(new Integer(a[1]))){
while(it.hasNext()){
if(jt2.getText().equals(it.next()))
jt3.setText( " ");
}
jt3.setText( " ");
}
else
if(jt1.getText().equals(new Integer(a[2]))){
while(it.hasNext()){
if(jt2.getText().equals(it.next()))
jt3.setText( " ");
}
jt3.setText( " ");
}
else
if(jt1.getText().equals(new Integer(a[3]))){