Rerunning Parts of Code

In this two class project I have created a GUI that takes the input from the user and calculates an answer. In my GUI class, I used a JOptionPane.showInputDialog to obtain the numbers from the user, and a JFrame with JButtons to choose the function. Is it possible, and if so how, to create a button that makes the JOptionPane part of code or, if that is not possible, the entire GUI class run again? Any help is appreciated.