I'm having a problem with a password. The password is an integer, but my problem is that when someone tries to enter a string input, the program crashes, instead i want it to display invalid like when someone tries to enter an invalid integer password. I also wish to display the password in asterik form. What do i have to do? Can someone pls help me? Thanks a lot!

The code i've written is below:-
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
public class GeographyQuiz extends JFrame implements ActionListener {
private static final int FRAME_WIDTH = 140;
private static final int FRAME_HEIGHT = 160;
private static final int FRAME_X_ORIGIN = 70;
private static final int FRAME_Y_ORIGIN = 50;
AnswerStore answerStore = new AnswerStore();
public static void main (String[] args) {
JFrame jFrame;
jFrame = new JFrame();
JOptionPane.showMessageDialog(jFrame, "This is a Geography Quiz");
JOptionPane.showMessageDialog(null, "Good Luck");
char choice;
int i, choice1, Password;
String yourChoice, passString;
passString = JOptionPane.showInputDialog("Enter the Password");
//Password = passString.nextInt();
Password = Integer.parseInt(passString.trim());
if (Password == 123) {
JOptionPane.showMessageDialog(null, "Valid. You typed the right password. Now choose from the following menu");
GeographyQuiz frame = new GeographyQuiz();
frame.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Invalid Password. Try Again");
}
}
}