aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes textbox field validation in gui Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "textbox field validation in gui" Watch "textbox field validation in gui" New topic
Author

textbox field validation in gui

David Winters Junior
Ranch Hand

Joined: Oct 30, 2007
Posts: 47
I have a query regarding how we can handle the situation whereby the user chooses an invalid db file , enters an invalid port number or tries to start the rmi server and leaving the database location and/or port field blank.

In my current design the user should enter these values in the Ui and click on the 'start' button in the gui to start the rmi server however just wondering how others have dealt with the sitation when the user enters invalid or no values for the database location field and/or port number. Do you display an error dialog to the user and allow him/her to re-enter these values in a seperate or the same window.

I would like to display a dialog message with the user message and then return to the original frame in which the textfields/ buttons resides so that the user can re-enter however i am not sure how to accomplish this.. is it possible in any way to allow for this.. so that normal program execution is suspended until teh user re-enters valid values and retires to start the server.

Any help/thoughts would be appreciated

thanks,
david
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2268
    
    3

Hey, partner.
I created a port number validator and an IP address validator too. They are 2 components For the server initialization, I provide 2 text fields, where the user enters the db location and the port number. You need to put these verifications inside the actionPerformed method of your ActionListener. Then you add this ActionListener to your "Start" button.
The idea of your ActionListener can be something like this:



Please take a look at the ActionListener interface and the JOptionPane class. I believe this is what you are looking for.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
David Winters Junior
Ranch Hand

Joined: Oct 30, 2007
Posts: 47
thanks alot for the reply and your suggestions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: textbox field validation in gui