i am building a simple chat application and i'm thinking to set the server address and port through JOptionPane, what i want to do is to check that the user is not entering letters in when setting up the port number,
int port=Integer.parseInt(JOptionPane.showInputDialog("Please insert the default port!");
i tried to handle it with a try/catch block but it didn't worked, any suggestions?