当前位置: 代码迷 >> J2SE >> 请大家帮小弟我改改啊
  详细解决方案

请大家帮小弟我改改啊

热度:31   发布时间:2016-04-24 15:04:51.0
请大家帮我改改啊.
import   javax.swing.*;  
import   java.awt.*;  
import   java.awt.event.*;  
import   java.lang.*;  
import   java.util.List.*;  
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(),  
jt2   =   new   JTextField(),  
jt3   =   new   JTextField();  

private   JPanel   panel   =   new   JPanel();  
int[]   a   =   new   int[20];  
List   b   =   new   ArrayList();   //说这里引用不明确,怎么改啊!  
int[]   c   =   new   int[30];  

public   Xingzuo(String   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   ActionListener1());  
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
pack();  
setVisible(true);  
}  

class   ActionListener1   implements   ActionListener{  
public   void   actionPerformed(ActionEvent   e){  
Iterator   it   =   b.iterator();  
for(int   i=1;i <=12;i++)  
a[i-1]=i;  
for(int   j=1;j <=21;j++){  
c[j-1]=j;  
b.add(new   c[j-1]);   //说找不到C.  
}  

if(jt1.getText().equals(a[0])){  
while(it.hasNext()){  
if(jt2.getText().equals(it.next()))  
jt3.setText( " ");  
}  
jt3.setText( " ");  
}  
}  
}  
public   void   main(String[]   args){  
Xingzuo   xingzuo   =   new   Xingzuo( "hello ");  
}  
}  


------解决方案--------------------
List b = new ArrayList(); //说这里引用不明确,怎么改啊!
这里改包import java.util.List;import java.util.ArrayList;
b.add(new c[j-1]); //说找不到C.肯定找不到,c 又不是类,你new它干什么
------解决方案--------------------
java.util.List b = new ArrayList();
------解决方案--------------------
给楼主调试了一下。行了。
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;

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(),
jt2 = new JTextField(),
jt3 = new JTextField();

private JPanel panel = new JPanel();
int[] a = new int[20];
ArrayList b = new ArrayList(); //说这里引用不明确,怎么改啊!
int[] c = new int[30];

public Xingzuo(String title){
  相关解决方案