Yes. A couple of different ways. First of all, you could use null
instead of rootPane
:
JOptionPane.showMessageDialog(null, "File was found");
You could also pass the function rootPane:
GUI pane = new GUI().setVisible(true);
checkIntegrity(pane);
and change the function deceleration accordingly:
public static void checkIntegrity(GUI rootPane){
You could finally make rootPane
a static variable (this is the way I would do it):
class theClass{
static GUI rootPane;
public static void main...
For this last one, you also have to set rootPane
:
rootPane = new GUI().setVisible(true);