这是刚运行后的界面点击确定后成这样了
刚下面的回答看不懂啊 我新手。
圈着的是那个弹出对话框的的代码。。放到RigisterFrame注册界面内的。
好像没有设定页面刷新吧。错误提示代码以后,加个页面刷新试试。
//a代表教徒,b代表非教徒
public class Test {
/**
public void next() {
if(now==30){
now=1;
}else{
now++;
}
}
public static void main(String[] arg){
Test t = new Test();
int num = 30;
while(num>15){
for(int i= 1;i<=9;i++){
t.next();
if(i==9){
t.map.put(t.now, "b");
num--;
}
}
}
System.out.println(t.map.values().toString());
}}
结果:[b, a, a, b, a, a, b, a, a, b, a, a, b, a, a, a, b, b, a, a, a, a, b, b, a, a, a, a, b, a]这是唯一问题
//a代表教徒,b代表非教徒
public class Test {
/**
Enter Content.
@author zhangjing
@date 2015-5-19
@param args
@see */ private HashMap map = new HashMap(); public Test(){ for(int i= 1 ; i<=30;i++){ map.put(i, "a"); } } private int now = 1;
public void next() {
if(now==30){
now=1;
}else{
now++;
}
}
public static void main(String[] arg){
Test t = new Test();
int num = 30;
while(num>15){
for(int i= 1;i<=9;i++){
t.next();
if(i==9){
t.map.put(t.now, "b");
num--;
}
}
}
System.out.println(t.map.values().toString());
}}
结果:[b, a, a, b, a, a, b, a, a, b, a, a, b, a, a, a, b, b, a, a, a, a, b, b, a, a, a, a, b, a]这是唯一问题
你可以在你显示对话框后面的操作代码处打断点,然后debug,看看传值情况
少年要学会使用debug啊,话说代码也没有,也很难才出来问题所在