how to stall a gui program
i am working on a program which allows a user to type in details about desktops and laptops,
details such as, name, ram size, hdd size and screen size. there is a text field for each of these details, the information is the sent to an xml file.
the second part of the program allows the user to display this info on a table.
my question is, is it possible to stall a program if the user leaves a JTextfield blank.
when a field is left blank the element in the xml file looks like this:
i tried to make a try/catch statement to stop the program
String itemName = name.getText();
i tried this which dose print an "error" on the console in eclipse but the info still gets printed into an xml file, what i want to do is stop the program from sending the info to the xml file until the text fields are filled.
thanks in advanced.
Re: how to stall a gui program
Not sure what "stall" means. If you disable all buttons etc until the user has entered all needed data, the user will not be able to press any buttons until they are enabled.
is it possible to stall a program if the user leaves a JTextfield blank.
Use listeners for all the input fields you want to ensure are filled and have them indicate that the data is present by using a flag.
This can be done by testing all the fields just before outputting the file. If any are not complete, send a message to the user and exit/return to wait for the user to enter the data.
i want to do is stop the program from sending the info to the xml file until the text fields are filled