巴顿工作了1次 [英] the butoon work for 1 time

查看:59
本文介绍了巴顿工作了1次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作一个程序电话簿",该程序会在输入姓名,邮件和号码后添加新用户,用户可以通过输入联系人号码来搜索任何联系人,用户也可以通过输入联系人号码来删除任何联系人..该程序具有3个添加,搜索和删除按钮..我在其中使用了3个联系人的数组列表,用户可以添加新的或搜索或删除,并且用户可以在添加后删除联系人.该程序在控制台中运行.在我将程序转到GUI后,程序可以运行,但是只有一个按钮有效,该按钮有效是您单击该按钮的第一个按钮...如果添加新按钮,则要删除该程序将被添加,因此忽略该程序等等.在...

i make a program " Phone Book " the program add new user after take his name,mail and number , the user can search for any contact by enter the contact number and the user can delete any contact by enter the contact number also.. the program has 3 buttons add, search and delete .. i used the array list with 3 contact in it and the user can add new or search or delete and the user can delete the contact after add it . the program run in console. after i turned the program to GUI the program run but only one button is work , the button is work is the first button you click on it ... if you add new it will add if you want to delete it the program ignore and so on ...

推荐答案

上,您正在使用Swing还是AWT?您的信息不足,请提供完整的信息.


谢谢.
are you using Swing or AWT ? your info is not sufficient, please provide complete info.


thanks.


您正在运行一个程序代码.

您需要将代码放入循环中:

You are running a procedural code.

You need to put your code into a loop:

// prolog
while(true){
    // exit condition
   // program code
}



-启动程序( prolog )并进入循环
-您定义了退出该循环的情况(例如按钮)(退出条件)
-否则循环将在(程序代码)上继续运行.


您的代码只能运行一次,因为它只能运行一次.您需要添加循环或其他返回"条件(*)才能回到前面并重新开始.



- You start your program (prolog)and enter the loop
- You define a situation (e.g. a button) to exit that loop (exit condition)
- Otherwise the loop run on and on (program code).


your code works once because it is run once. You need to add a loop or another "return" condition(*) to get back in front and start over.


这篇关于巴顿工作了1次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆