I have JLabels in multiple JFrames, and all of them serve the purpose of being a status indicator. In the class Controller, I have a method that changes the JLabel in the given JFrame. My question is that how do I reference the JFrame as a variable?
import javax.swing.*;
public class Controller {
public static class Status {
public static void vPrint(JFrame frame, String text) {
JLabel label = frame.getConsoleLabel();
label.setText(text)
}
}
}
So when I call it in the JFrame:
Controller.Status.vPrint(this, "Set the JLabel Text.");
All of the JFrames have the method getConsoleLabel()
The problem is that when I call it, it says: cannot find symbol: method
and I think the cause is that the variable frame isn't referenced.
Any solutions?