I am trying to do some validation checks on inputs, which I'm having some issues with. I need to be able to check that the url entered is valid, return it's boolean value. If true it allows it to be assigned as myURL, else it will give me the JOptionPane message and stop. These will be checked from fields of entered data. This is part of a larger project, so any and all input is welcomed and appreciated.
public String SetURL (String a) { if (ValidateURL(a)) { myURL = a; } else { JOptionPane.showMessageDialog (null, "Sorry the URL: " + SetURL() + " is an invalid URL", "Incorrect Information", JOptionPane.INFORMATION_MESSAGE); } }
public Boolean ValidateURL () { //Some code here to check the validation and return a true of false }