This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.